Skip to content

docs: improve Dockerfile for hardened images#2270

Open
dunglas wants to merge 4 commits intomainfrom
fix/mercure-hardened
Open

docs: improve Dockerfile for hardened images#2270
dunglas wants to merge 4 commits intomainfrom
fix/mercure-hardened

Conversation

@dunglas
Copy link
Member

@dunglas dunglas commented Mar 11, 2026

Prevents errors like this one when using Mercure: php-1 | Error: loading initial config: loading new config: loading frankenphp app module: provision frankenphp: failed to provision caddy http: loading http app module: provision http: server srv0: setting up route handlers: route 2: loading handler modules: position 2: loading module 'mercure': provision http.handlers.mercure: provision http.handlers.mercure.bolt: "": invalid transport: open /data/caddy/mercure.db: permission denied

Copilot AI review requested due to automatic review settings March 11, 2026 16:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the hardened/distroless Dockerfile example in the Docker documentation to copy Caddy’s writable directories differently, aiming to ensure the Caddy state/config paths are present and owned correctly when running as nonroot.

Changes:

  • Adjusts the distroless example to COPY /data and /config from the builder stage (instead of only /data/caddy and /config/caddy).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henderkes
Copy link
Contributor

I don't understand how this fixes the error. Does the nonroot user not have execute permissions on /data?

@dunglas dunglas changed the title docs: fix Mercure support with Docker hardened images docs: improve Dockerfile for hardened images Mar 12, 2026
@dunglas dunglas requested a review from Copilot March 12, 2026 13:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dunglas
Copy link
Member Author

dunglas commented Mar 12, 2026

@henderkes actually, it's an edge case I found in dunglas/symfony-docker#909, where data and config directories are mounted as volumes. But this is quite common.

dunglas and others added 4 commits March 24, 2026 11:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
@dunglas dunglas force-pushed the fix/mercure-hardened branch from e4f2ee9 to 15d2892 Compare March 24, 2026 11:10
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 this pull request may close these issues.

3 participants