瀏覽代碼

Docker内指定Profile文件

develop
林万龙 4 年之前
父節點
當前提交
cb2542de28
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. +6
    -5
      Dockerfile

+ 6
- 5
Dockerfile 查看文件

@@ -10,12 +10,13 @@ ENV TimeZone=Asia/Shanghai
ENV active=dev
ENV profileName="classpath:/application.properties"
ENV JAVA_OPTS="-Xmx256M -Xms256M"
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 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
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
#ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /gd202101.jar --spring.config
#.location=$profileName

Loading…
取消
儲存