From 15cf607e082c98cc8b276f41b363f249c5825689 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Thu, 14 Jan 2021 19:10:00 +0800 Subject: [PATCH] =?UTF-8?q?Docker=E5=86=85=E6=8C=87=E5=AE=9AProfile?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c48c424..3b882b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,16 @@ COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas ENV TimeZone=Asia/Shanghai ENV active=dev +ENV profileName="classpath:/application.properties" ENV JAVA_OPTS="-Xmx256M -Xms256M" - +RUN if [ "$active" = "dev" ] ; then $profileName="classpath:/application-dev.properties"; fi +RUN if [ "$active" = "test" ] ; then $profileName="classpath:/application-test.properties"; fi +RUN if [ "$active" = "pro1" ] ; then $profileName="classpath:/application-pro1.properties"; fi +RUN if [ "$active" = "pro2" ] ; then $profileName="classpath:/application-pro2.properties"; fi +RUN if [ "$active" = "pro3" ] ; then $profileName="classpath:/application-pro3.properties"; fi #RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #RUN echo "Asia/Shanghai" > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone -ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /gd202101.jar --spring.profiles.active=$active \ No newline at end of file +#ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /gd202101.jar --spring.profiles.active=$active + +ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /gd202101.jar --spring.config.location=$profileName \ No newline at end of file