Skip to content

Build docker image using spring profile and pass environment variable during image build

Notifications You must be signed in to change notification settings

hamzalounissi/buildDockerImage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project shows you how you can use multiple configuration depending on the build profil dev | prod.

Also how we can set Environment variable.

In order to build the project with dev profile

./mvnw -Pdev install

In order to build the project with prod profile

./mvnw -Pprod install

Run docker image using docker compose providing env variable

ENVIRONMENT_VAR=hello docker-compose up -d

List active container

docker container ls

See container log with

docker logs 891e6a114f35 ( Containr Id)

To verify the response of WS using curl

curl localhost:8080/api/health/version curl localhost:8080/api/health/environmentVar

About

Build docker image using spring profile and pass environment variable during image build

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages