Skip to content

[deploy] COPY config bakes config directory into image layer alongside runtime bind mount #287

@obchain

Description

@obchain

PR: #55 (feat/27-docker-compose)
Files: Dockerfile line 36; deploy/compose/docker-compose.yml volumes block

The Dockerfile performs:

COPY config ./config

The compose file simultaneously bind-mounts the same directory at runtime:

volumes:
  - ../../config:/app/config:ro

This creates two problems:

  1. Layer bake-in: Every file in config/ at build time is baked into the image layer and visible in docker history charon:local. If a developer inadvertently writes a secret value into a TOML file (an ongoing risk given the ${ENV_VAR} substitution pattern in the config loader), that secret is permanently in the image layer even after the bind mount overlays it at runtime.

  2. Divergence risk on standalone runs: A docker run charon:local without compose will use the baked-in config/default.toml, which may contain placeholder or stale values. There is no visible error — the binary starts with silently wrong config. This is particularly dangerous given that contract addresses and RPC endpoints are embedded in TOML.

The runtime bind mount makes the build-time COPY redundant. The correct approach is to remove COPY config ./config from the Dockerfile and require operators to always use the compose bind mount or an explicit -v flag.

Suggested fix: Remove COPY config ./config from the Dockerfile. Add config/ to .dockerignore. Document in the README deploy section that running without a config mount is unsupported and will fail.

Refs #55

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:devopsCI / deploy / infra / telemetrypr-reviewFindings from PR review processpriority:p1-coreCore MVP scopestatus:readyScoped and ready to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions