Skip to content

build(docker): Package the application as a production container image#101

Merged
ebouchut merged 1 commit into
devfrom
build/docker-packaging
Jul 13, 2026
Merged

build(docker): Package the application as a production container image#101
ebouchut merged 1 commit into
devfrom
build/docker-packaging

Conversation

@ebouchut

@ebouchut ebouchut commented Jul 13, 2026

Copy link
Copy Markdown
Owner

This PR packages the learn-dev Web application as a Docker image.

A multi-stage Dockerfile:

  1. Builds the executable jar with Maven
  2. 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 prod session 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 .dockerignore file 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 distributionManagement in pom.xml is intentional).

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

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.53%. Comparing base (b446331) to head (6a563fb).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ebouchut
ebouchut merged commit a9c1de2 into dev Jul 13, 2026
7 checks passed
@ebouchut
ebouchut deleted the build/docker-packaging branch July 13, 2026 21:06
@github-project-automation github-project-automation Bot moved this from In Review to Done in learn-dev-project Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant