diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b9e3905 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM bitnami/java:17-debian-12 + +COPY target/*.jar /app/app.jar + +COPY script/entrypoint.sh /opt/scripts/entrypoint.sh +RUN chmod 0740 /opt/scripts/entrypoint.sh + +CMD /opt/scripts/entrypoint.sh \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5d3f0f4..94ad21d 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,6 @@ ec-config-server 1.0.0-SNAPSHOT - jar diff --git a/script/entrypoint.sh b/script/entrypoint.sh new file mode 100644 index 0000000..af05428 --- /dev/null +++ b/script/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +if test "${SPRING_PROFILES_ACTIVE}" != ''; +then + echo "spring active profile is "$SPRING_PROFILES_ACTIVE + JAVA_OPTIONS="$JAVA_OPTIONS -Dspring.profiles.active=cloud,native,$SPRING_PROFILES_ACTIVE" +fi + +if test "${LOCAL_DOCKER_ENV}" = 'true'; +then + JAVA_OPTIONS="$JAVA_OPTIONS -Dspring.profiles.active=native" +fi + +java $JAVA_OPTIONS -jar /app/app.jar \ No newline at end of file