build(docker): Package the application as a production container image#101
Merged
Conversation
A multi-stage Dockerfile builds the executable jar with Maven (with a warmed dependency layer) and runs it on a minimal JRE 21 image as a non-root user with the prod profile active. The prod profile itself is fixed and hardened: its header no longer claims to be the dev profile, the session cookie is Secure, forwarded headers are honored so links generated behind the TLS-terminating proxy use https, and the SMTP relay comes from SMTP_* environment variables (documented in .env.example). The .dockerignore keeps .env, build output, and docs out of the image. Packaging is local only: the image is not pushed to any registry and no Maven artifact is deployed to any repository (the pom deliberately has no distributionManagement), as the README section states.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #101 +/- ##
=========================================
Coverage 77.53% 77.53%
Complexity 141 141
=========================================
Files 31 31
Lines 592 592
Branches 37 37
=========================================
Hits 459 459
Misses 106 106
Partials 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR packages the learn-dev Web application as a Docker image.
A multi-stage
Dockerfile:jarwith MavenThe
prodprofile itself is fixed and hardened.Its header no longer claims to be the
devprofile.The
prodsession cookie is Secure, forwarded headers are honored, so links generated behind the TLS-terminating proxy use HTTPS.The SMTP relay used
SMTP_environment variables (See .env.example).Warning
The
.dockerignorefile keeps.env, build output, and docs out of the image.Important
For now, packaging is local only (until I assess the potential legal implications).
The Docker image is not pushed to any registry, and no Maven artifact is deployed to any repository (The absence of
distributionManagementinpom.xmlis intentional).