Skip to content

Commit 62c4944

Browse files
committed
feat: improve docker build
1 parent 27fbed2 commit 62c4944

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Dockerfile-Native
1+
Dockerfile-Jvm

Diff for: Dockerfile-Jvm

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM eclipse-temurin:17-jdk-alpine
22
VOLUME /tmp
33
ARG SPRING_PROFILE=prod
44
ENV MY_SPRING_PROFILE=$SPRING_PROFILE
5-
ARG JAR_FILE
6-
ADD backend/build/libs/$JAR_FILE /app.jar
5+
ARG APP_FILE
6+
ADD backend/${APP_FILE} /app.jar
77
ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+UseStringDeduplication"
88
ENTRYPOINT exec java $JAVA_OPTS -Dspring.profiles.active=$MY_SPRING_PROFILE -Dliquibase.duplicateFileMode=WARN -Djava.security.egd=file:/dev/./urandom -jar /app.jar

Diff for: Dockerfile-Native

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ VOLUME /tmp
33
ARG SPRING_PROFILE=prod
44
ENV MY_SPRING_PROFILE=$SPRING_PROFILE
55
ARG APP_FILE
6-
ADD backend/build/native/nativeCompile/$APP_FILE /application
6+
ADD backend/$APP_FILE /application
77
#ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+UseStringDeduplication"
88
ENTRYPOINT exec /application

Diff for: buildDocker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22
#./gradlew clean build -PwithAngular=true -PuseChromium=true
33
./gradlew clean build -PwithAngular=true
4-
docker build -t angular2guy/angularandspringwithmaps:latest --build-arg JAR_FILE=angularAndSpringWithMaps.jar --no-cache .
4+
docker build -t angular2guy/angularandspringwithmaps:latest --build-arg APP_FILE=build/libs/angularAndSpringWithMaps.jar --no-cache .
55
docker run -p 8080:8080 --memory="384m" --network="host" angular2guy/angularandspringwithmaps:latest

Diff for: buildNative.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ java -Dspring.aot.enabled=true -agentlib:native-image-agent=config-merge-dir=bac
2525
# run native binary(more than 160MB)
2626
./backend/build/native/nativeCompile/backend
2727
# build Docker image
28-
docker build -t angular2guy/angularandspringwithmaps-native:latest --build-arg APP_FILE=backend --no-cache .
28+
docker build -t angular2guy/angularandspringwithmaps-native:latest --build-arg APP_FILE=native/nativeCompile/backend --no-cache .
2929
# run Docker image
3030
docker run -p 8080:8080 --memory="210m" --network="host" angular2guy/angularandspringwithmaps-native:latest

0 commit comments

Comments
 (0)