I am trying build docker image for my spring boot docker using the command
mvn spring-boot:build-image
And below is my docker-compose.yml
version: '3.3'
services:
spring-boot-container:
ports:
- '7000:7000'
environment:
- SPRING_PROFILES_ACTIVE=${environment}
- JASYPT_ENCRYPTOR_PASSWORD=${JASYPT_ENCRYPTOR_PASSWORD}
- cloud_config_uri=${cloud_config_uri}
- "JAVA_OPTS=-Dspring.cloud.config.uri=http://localhost:8888"
image: 'artifactory.cloud.health.com/docker-all/spring_boot_app:latest'
restart: always
container_name: spring_boot_app
But my spring boot app is not coming up with proper profiles and not picking java _opts.
Basically in old approach i create dockerfile, then i give ENTRYPOINT
where i pass -Dspring.active.profiles
.
But since we using mvn spring-boot:build-image
i dont know how we pass those entrypoint variables.
SPRING_PROFILES_ACTIVE=dev
? Why this complex resolution? Also unless you do something withJAVA_OPTS
it won't do a thing. Also shouldn't the"
be removed? – M. Deinum${environment}
if that can't be resolved it will error out. – M. Deinum${environment}
will be resolved inside the docker container not on your local system. – M. Deinum