Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile improvements #621

Closed
2 of 3 tasks
dennisvang opened this issue Feb 17, 2025 · 0 comments · Fixed by #626
Closed
2 of 3 tasks

Dockerfile improvements #621

dennisvang opened this issue Feb 17, 2025 · 0 comments · Fixed by #626

Comments

@dennisvang
Copy link
Contributor

dennisvang commented Feb 17, 2025

The Dockerfile explicitly specifies the production profile and corresponding application config files:

COPY --from=builder /builder/target/classes/application-production.yml /fdp/application.yml
ENTRYPOINT java -jar app.jar --spring.profiles.active=production --spring.config.location=classpath:/application.yml,classpath:/application-production.yml,file:/fdp/application.yml

This makes life difficult if we want to run the container with a different profile, as in the following:

It would be more convenient to allow specifying the profile using environment variables.

While we're at it, perhaps we could introduce some optimizations and security improvements, as suggested in the spring-boot docs etc.

  • profiles using env variables (also see externalized configuration)

  • don't run as root

  • efficient container image (probably requires github actions cache to make a difference)

            uses: docker/build-push-action@v6
            with:
              ...           
              cache-from: type=gha
              cache-to: type=gha,mode=max
@dennisvang dennisvang changed the title Hardcoded spring profile in Dockerfile Dockerfile improvements Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant