Description

This spring boot project holds demos to show-case the usage of profiles and basic docker usage.

Switching between profiles

To activate set the environment variable accordingly (PowerShell example).

$env:spring.profiles.active={prod,dev0,sprint,...}

You can also override specific values e.g.

$env:message=this is prod (env)

Docker cheet sheet

# Build image
docker build -t myorg/myapp:dev .

# Peek into image
docker run -ti --entrypoint /bin/sh myorg/myapp:dev

# Run image
docker run -p 8080:8080 myorg/myapp

# Peek into running container
docker exec -ti container_name /bin/sh

Mixed notes

  • More than a single profile at a time can be active
  • If no profile is specified (spring.profiles.active=null) the default one will be used
  • Properties from the default profile can be used from a specific profile (even if not explicitly defined)

Further reading

Configuration

Docker