简体   繁体   中英

Spring Boot dockerfile configuration location argument not loading

Im Developing a simple docker file for a spring boot war file.

FROM openjdk:8-jdk-alpine

ARG CONFIG_LOC=/app_config
RUN mkdir $CONFIG_LOC

COPY app_config/* $CONFIG_LOC/ 

ARG JAR_FILE=target/*.war
COPY ${JAR_FILE} app.war

ENTRYPOINT ["java","-Dspring.config.location=/app_config","-Dspring.profiles.active=docker","-jar","/app.war"]

Some how the argument config location is not are not loading when running the spring application. So the spring application is not running.

Is there a reason to use these as arguments? Usually using something like ARG CONFIG_LOC means you're passing a value in your build command using --build-arg . Seems like in this build you should just use hard coded values. When running the application, any argument should be passed as an environment variable using the -e flag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM