I have a Spring Boot application which i intent to deploy as a docker container.
I'm using a DOCKERFILE to build the image with entrypoint: ENTRYPOINT ["java", "-jar", "myFolder/app.jar"]
The image is buildt in a JENKINSFILE like this:
docker build . -t repo/app:latest
I'm using a script to run the docker image. I want to set a custom property's value based on an argument to that script.
So say I have a custom property: custom.property.isTest=false
.
It controls which class a bean should return an instance of e.g
@Value("${custom.property.isTest:false}")
boolean isTest;
@Bean
public MyService myServiceImpl(){
if(isTest) {
return new myServiceTestImpl();
} else {
return new myServiceImpl();
}
}
I want to be able to set this value when I run the docker image.
e.g using the parameter: -e
to do something like this(doesn't work) 'custom.property.isTest=true'
.
Is that possible?
Thanks