У меня есть docker-compose.yml для приложения Spring Boot, в котором есть следующая запись:
paramer:
image: miko/paramer:0.2.0
build:
context: ../paramer-docker/build
args:
profile: docker
container_name: miko-paramer
ports:
- "8050:8050"
restart: unless-stopped
Связанный Dockerfile выглядит следующим образом:
ARG profile
COPY ./external/paramer-* app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=$profile","-jar","app.jar"]
Однако онвыдает ошибку при docker-compose:
miko-paramer | 12:42:54.334 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
miko-paramer | java.lang.IllegalArgumentException: Could not resolve placeholder 'PROFILE' in value "${PROFILE}"
miko-paramer | at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
miko-paramer | at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
miko-paramer | at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236)
miko-paramer | at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
miko-paramer | at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:227)
miko-paramer | at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:83)
miko-paramer | at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:61)
miko-paramer | at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:530)
miko-paramer | at org.springframework.core.env.AbstractEnvironment.doGetActiveProfiles(AbstractEnvironment.java:240)
miko-paramer | at org.springframework.core.env.AbstractEnvironment.getActiveProfiles(AbstractEnvironment.java:226)
miko-paramer | at org.springframework.boot.SpringApplication.configureProfiles(SpringApplication.java:531)
miko-paramer | at org.springframework.boot.SpringApplication.configureEnvironment(SpringApplication.java:454)
miko-paramer | at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:335)
miko-paramer | at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
miko-paramer | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
miko-paramer | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
miko-paramer | at com.miko.paramer.ParamerApplication.main(ParamerApplication.java:18)
miko-paramer | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
miko-paramer | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
miko-paramer | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
miko-paramer | at java.lang.reflect.Method.invoke(Method.java:498)
miko-paramer | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
miko-paramer | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
miko-paramer | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
miko-paramer | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
miko-paramer exited with code 1
Видно, что profile
не заменяется и выглядит как заглавные буквы в журналах PROFILE
Как это исправить?