【发布时间】:2019-09-09 17:30:51
【问题描述】:
我的 Dockerfile 中有以下内容来运行我的 Springboot 应用程序:
ENTRYPOINT [ "java", "-jar", "/code/myapp/target/myapp.jar", "--spring.profiles.active=$ENV_PROFILE"]
我在我的 k8 YAML 配置中将我的环境变量 (ENV_PROFILE) 定义为:
spec:
containers:
- name: myspringboot
image: myrepo/myapp:latest
imagePullPolicy: Always
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: ENV_PROFILE
value: "test"
但是,环境名称没有被注入 java springboot 应用程序。它在日志中显示为“$ENV_PROFILE”。我还尝试通过添加 spring.profiles.active=$ENV_PROFILE 来使用 application.properties
这也不起作用。
【问题讨论】:
-
你能在入口点尝试 ($ENV_PROFILE) 代替 $ENV_PROFILE 吗?
标签: spring spring-boot kubernetes