[H-8] Docker build broken and leaky: dev compose release path hardcoded to _build/prod; .dockerignore not honored (context is parent dir) #12

Closed
opened 2026-11-14 18:28:45 +01:00 by amiryahaya · 1 comment
Owner

Finding

(a) Dockerfile:87 hardcodes /app/_build/prod/rel/mdid_ws while dev builds emit _build/dev, so the dev compose override cannot build; its runtime command also needs git/SSH absent from the slim runner. (b) compose sets context: .., and ignore files are only read from the context root or Dockerfile.dockerignore — so mdid_ws/.dockerignore matches neither and the entire parent workspace (sibling repos, .git, .env) is uploaded as build context.

Evidence

  • Dockerfile:87 — hardcoded _build/prod COPY
  • docker-compose.yml:7-9 — context: .., dockerfile: mdid_ws/Dockerfile
  • docker-compose.dev.yml:15-17, 37-45 — MIX_ENV dev + runtime mix deps.get

Impact

Dev compose unusable; build context leakage of the whole workspace to the Docker daemon.

Fix

  • Parametrize the release path (ARG MIX_ENV re-declared in the runner stage)
  • Rename the ignore file to Dockerfile.dockerignore (or move it to the actual context root)
  • Fix dev compose to precompile in the builder and mount only sources

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding (a) `Dockerfile:87` hardcodes `/app/_build/prod/rel/mdid_ws` while dev builds emit `_build/dev`, so the dev compose override cannot build; its runtime command also needs git/SSH absent from the slim runner. (b) compose sets `context: ..`, and ignore files are only read from the context root or `Dockerfile.dockerignore` — so `mdid_ws/.dockerignore` matches neither and the entire parent workspace (sibling repos, .git, .env) is uploaded as build context. ## Evidence - `Dockerfile:87` — hardcoded `_build/prod` COPY - `docker-compose.yml:7-9` — `context: ..`, `dockerfile: mdid_ws/Dockerfile` - `docker-compose.dev.yml:15-17, 37-45` — MIX_ENV dev + runtime `mix deps.get` ## Impact Dev compose unusable; build context leakage of the whole workspace to the Docker daemon. ## Fix - [ ] Parametrize the release path (`ARG MIX_ENV` re-declared in the runner stage) - [ ] Rename the ignore file to `Dockerfile.dockerignore` (or move it to the actual context root) - [ ] Fix dev compose to precompile in the builder and mount only sources _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Author
Owner

Verified fixed on main (1b6216b): Dockerfile release path follows ARG MIX_ENV; .dockerignore at the repo-root context; dev compose uses the dev target (B2).

Verified fixed on main (1b6216b): Dockerfile release path follows ARG MIX_ENV; .dockerignore at the repo-root context; dev compose uses the dev target (B2).
Sign in to join this conversation.
No description provided.