Skip to content

fix: give dev compose builds their own image tags so a pulled ghcr image can't replace them - #330

Open
milkoilari wants to merge 1 commit into
Anyesh:mainfrom
milkoilari:fix/dev-compose-image-tags
Open

milkoilari wants to merge 1 commit into
Anyesh:mainfrom
milkoilari:fix/dev-compose-image-tags

Conversation

@milkoilari

@milkoilari milkoilari commented Nov 11, 2026 •

Copy link
Copy Markdown

Description

Since #83, docker-compose.yml sets image: ghcr.io/anyesh/wardrowbe:*-latest on backend, frontend and workers. docker-compose.dev.yml adds build: to those services but inherits the image: names, so the dev build and the published production image share one tag.

When the production image is the one present locally (for example after docker compose pull, or after running the default stack on the same machine), it can run in place of the Dockerfile.dev build. A new, empty frontend_node_modules volume is then seeded from the production image's /app/node_modules, which is the trimmed copy from Next's output: 'standalone' trace: react-dom without client.js, @swc/helpers with a handful of files instead of ~400. The startup npm install trusts node_modules/.package-lock.json and never repairs those packages.

Result: next dev fails with Module not found: Can't resolve 'react-dom/client' (and @swc/helpers/_/_class_private_field_loose_base), and every page returns 500. The log mostly shows the follow-up error, ENOENT: ... /app/.next/fallback-build-manifest.json, raised while rendering the error page, which hides the real cause.

The reverse also happens: building the dev stack retags the dev image as ghcr.io/anyesh/wardrowbe:frontend-latest, so a later docker compose up with only the default file runs the dev image.

Fix

Give the built services their own local tags with pull_policy: build:

  • frontend → wardrowbe-frontend:dev
  • backend, worker, image-worker → wardrowbe-backend:dev

Dev images are now always built locally and never collide with the ghcr tags. A short note in the file header explains why.

Existing broken volumes

This prevents new volumes from being seeded with the wrong content. A volume that is already broken can be repaired without deleting it:

docker compose -f docker-compose.yml -f docker-compose.dev.yml stop frontend
docker compose -f docker-compose.yml -f docker-compose.dev.yml run --rm --no-deps frontend npm ci
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d

Related Issue

None found. I searched open and closed issues and PRs for these symptoms.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works (compose config only, no test harness for it)
  • New and existing tests pass locally (no code changes)
  • I have updated documentation as needed (header note in docker-compose.dev.yml)
  • My changes don't introduce new warnings or errors

Testing

Test Environment

  • Docker Compose
  • Kubernetes
  • Local development

Tests Performed

  • Reproduced the failure: a dev volume seeded from the ghcr frontend image had 23 packages owned by uid 1001 (nextjs) with standalone-trimmed contents, and GET / returned 500.
  • docker compose -f docker-compose.yml -f docker-compose.dev.yml config --images now lists only wardrowbe-frontend:dev and wardrowbe-backend:dev for the built services.
  • Rebuilt, repaired the volume with npm ci, recreated the stack: all services run on the :dev images, GET / returns 200, the home page renders in the browser with no console errors.

Additional Notes

pull_policy: build makes up run a build every time. The layer cache makes this quick, and it is what keeps a registry image from replacing the dev build.

🤖 Generated with Claude Code

Summary by Sourcery

Isolate Docker Compose development images from published production tags to ensure development builds are always used.

Bug Fixes:

  • Prevent development Compose services from using or overwriting published production images, avoiding broken frontend dependency volumes and development startup failures.

Enhancements:

  • Assign dedicated local development image tags to backend, frontend, worker, and image-worker services and require local builds for them.

Build:

  • Update the development Compose configuration to build services with isolated local tags and build pull policy.

Documentation:

  • Document why development services use separate local image tags.

…age can't replace them

The dev override inherits `image: ghcr.io/anyesh/wardrowbe:*-latest` from
docker-compose.yml, so the dev build and the published production image
share a tag. When the production image is the one present locally, it runs
in place of the Dockerfile.dev build, and an empty frontend_node_modules
volume gets seeded from its standalone-traced node_modules (react-dom
without client.js, @swc/helpers with a handful of files). The startup
`npm install` trusts the hidden lockfile and never repairs them, so
`next dev` fails with "Module not found: react-dom/client" and every page
returns 500 with only an ENOENT on .next/fallback-build-manifest.json.

Tag the built services wardrowbe-{frontend,backend}:dev with
pull_policy: build, so dev images are always built locally and no longer
overwrite the ghcr tags that docker-compose.yml runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Give dev-built services distinct local image tags and require local builds, preventing conflicts with the production GHCR images; the header comment explains the reason.

  • docker-compose.dev.yml L10-14 (+4 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your first pull request to Wardrowbe! Please make sure you've read the CONTRIBUTING guide, especially the PR title format section. A maintainer will review this soon.

@github-actions github-actions Bot added the docker Pull requests that update docker code label Nov 11, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docker-compose.dev.yml" line_range="38" />
<code_context>
     restart: unless-stopped

   backend:
+    image: wardrowbe-backend:dev
+    pull_policy: build
     build:
</code_context>
<issue_to_address>
**Concurrent checkouts use the wrong image**

When two checkouts with different code run their dev Compose builds concurrently against the same Docker daemon, the builds overwrite the same daemon-wide tags, so one checkout can retag an image while the other is creating containers; the latter then starts from the other checkout’s code instead of its own.

Use a tag unique to the checkout or project for each dev build, and configure the services in that stack to use that tag.

Also at `docker-compose.dev.yml:53`, `docker-compose.dev.yml:69`, `docker-compose.dev.yml:84`.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: docker-compose.dev.yml:38


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docker-compose.dev.yml
restart: unless-stopped

backend:
image: wardrowbe-backend:dev

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Concurrent checkouts use the wrong image

When two checkouts with different code run their dev Compose builds concurrently against the same Docker daemon, the builds overwrite the same daemon-wide tags, so one checkout can retag an image while the other is creating containers; the latter then starts from the other checkout’s code instead of its own.

Use a tag unique to the checkout or project for each dev build, and configure the services in that stack to use that tag.

Also at docker-compose.dev.yml:53, docker-compose.dev.yml:69, docker-compose.dev.yml:84.

Prompt for AI agents
In `docker-compose.dev.yml` at line 38:

**Concurrent checkouts use the wrong image**

When two checkouts with different code run their dev Compose builds concurrently against the same Docker daemon, the builds overwrite the same daemon-wide tags, so one checkout can retag an image while the other is creating containers; the latter then starts from the other checkout’s code instead of its own.

Use a tag unique to the checkout or project for each dev build, and configure the services in that stack to use that tag.

Also at `docker-compose.dev.yml:53`, `docker-compose.dev.yml:69`, `docker-compose.dev.yml:84`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update docker code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants