admin管理员组文章数量:1355540
I have .env
file and I can't run docker-compose.yml
at remote server, I can not inject any environment variable to make the application able to integrate with another docker with database:
# stage 1
FROM eclipse-temurin:8-alpine AS build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD . $HOME
RUN --mount=type=cache,target=/root/.m2 ./mvnw -f $HOME/pom.xml clean install
# stage 2
FROM eclipse-temurin:8-alpine
ARG JAR_FILE=/usr/app/target/*.jar
COPY --from=build $JAR_FILE /app/runner.jar
ARG ENV_FILE=/usr/app/.env
COPY --from=build $ENV_FILE /app/.env
ARG INIT_FILE=/usr/app/contextinit.sh
COPY --from=build $INIT_FILE /app/contextinit.sh
RUN chmod +x /app/contextinit.sh
CMD ["/bin/bash","/app/contextinit.sh"]
ENTRYPOINT java -jar -Dspring.profiles.active=prod /app/runner.jar
the content mentioned above contextinit.sh
is: set -a && . .env && set +a
of course.
How to inject credentials to make it available for dockerized spring application started at ENTRYPOINT
? Spring app runs successfully, but without necessary context. Unfortunately the good working docker-compose.yml
is not recognized on the remote server, so I plan to do everything in Dockerfile
only.
本文标签: javaInject variables from file to Dockerfile ENTRYPOINTStack Overflow
版权声明:本文标题:java - Inject variables from file to Dockerfile ENTRYPOINT - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743980703a2571068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论