Skip to content

Commit af7106f

Browse files
committed
feat: add native Docker image
1 parent 1b1d8ec commit af7106f

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

Dockerfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile-Native

Dockerfile-Jvm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM eclipse-temurin:17-jdk-alpine
2+
VOLUME /tmp
3+
ARG SPRING_PROFILE=prod
4+
ENV MY_SPRING_PROFILE=$SPRING_PROFILE
5+
ARG JAR_FILE
6+
ADD backend/build/libs/$JAR_FILE /app.jar
7+
ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+UseStringDeduplication"
8+
ENTRYPOINT exec java $JAVA_OPTS -Dspring.profiles.active=$MY_SPRING_PROFILE -Dliquibase.duplicateFileMode=WARN -Djava.security.egd=file:/dev/./urandom -jar /app.jar

Dockerfile-Native

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ubuntu:jammy
2+
VOLUME /tmp
3+
ARG SPRING_PROFILE=prod
4+
ENV MY_SPRING_PROFILE=$SPRING_PROFILE
5+
ARG APP_FILE
6+
ADD backend/build/native/nativeCompile/$APP_FILE /application
7+
#ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+UseStringDeduplication"
8+
ENTRYPOINT exec /application

buildDocker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#./gradlew clean build -PwithAngular=true -PuseChromium=true
33
./gradlew clean build -PwithAngular=true
44
docker build -t angular2guy/angularandspringwithmaps:latest --build-arg JAR_FILE=angularAndSpringWithMaps.jar --no-cache .
5-
docker run -p 8080:8080 --memory="1g" --network="host" angular2guy/angularandspringwithmaps:latest
5+
docker run -p 8080:8080 --memory="384m" --network="host" angular2guy/angularandspringwithmaps:latest

buildNative.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ java -Dspring.aot.enabled=true -agentlib:native-image-agent=config-merge-dir=bac
2323
# native build
2424
./gradlew clean nativeCompile -PwithAngular=true -PuseChromium=true
2525
# run native binary(more than 160MB)
26-
./backend/build/native/nativeCompile/backend
26+
./backend/build/native/nativeCompile/backend
27+
# build Docker image
28+
docker build -t angular2guy/angularandspringwithmaps-native:latest --build-arg APP_FILE=backend --no-cache .
29+
# run Docker image
30+
docker run -p 8080:8080 --memory="210m" --network="host" angular2guy/angularandspringwithmaps-native:latest

0 commit comments

Comments
 (0)