【发布时间】:2021-09-15 07:38:54
【问题描述】:
我正在关注关于如何使用 docker 进行 spring boot 的 spring io 文章。所以使用 Dockerfile https://github.com/spring-guides/top-spring-boot-docker/tree/main/demo
问题:测试失败
由:java.lang.IllegalArgumentException 引起 PropertyPlaceholderHelper.java:178
我的应用程序有一些环境变量依赖
jasypt.encryptor.password=${mjasypt.secret}
jasypt.encryptor.algorithm=${mjasypt.algo}
我正在运行如下构建
docker build --build-arg DEPENDENCY=build/dependency -t ....
我在 dockerfile 中尝试了 3 个新的环境参数
ARG CBS=a
ARG JSP=b
ARG JSA=c
并更新入口点
ENTRYPOINT ["java","-noverify","-XX:TieredStopAtLevel=1","-cp","app:app/lib/*","-Dspring.main.lazy-initialization=true","-Dv1=${CBS}", "-Dv2=${JSP}", "-Dv3=${JSA}",...
和运行命令一样,但没有工作
docker build --build-arg DEPENDENCY=build/dependency --build-arg CBS=.. --build-arg JSP=..1 --build-arg JSA=P..ES -t ...
我在 dockerfile 中添加了 RUN echo ${CBS} 并且我可以看到我从 docker build 传递的值(不是 a),但是我怎么知道它是否也在 ENTRY POINT 中
更正: Dockerfile 是多阶段的,也有
运行 --mount=type=cache,target=/root/.gradle ./gradlew clean build
在运行测试时如何将值传递给该命令
【问题讨论】:
标签: spring-boot docker