Repository navigation
fix: give dev compose builds their own image tags so a pulled ghcr image can't replace them - #330
milkoilari wants to merge 1 commit into
Conversation
…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>
Reviewer's GuideConfigurationGive dev-built services distinct local image tags and require local builds, preventing conflicts with the production GHCR images; the header comment explains the reason.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
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. |
There was a problem hiding this comment.
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
| restart: unless-stopped | ||
|
|
||
| backend: | ||
| image: wardrowbe-backend:dev |
There was a problem hiding this comment.
🟡 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`.
Description
Since #83,
docker-compose.ymlsetsimage: ghcr.io/anyesh/wardrowbe:*-lateston backend, frontend and workers.docker-compose.dev.ymladdsbuild:to those services but inherits theimage: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 theDockerfile.devbuild. A new, emptyfrontend_node_modulesvolume is then seeded from the production image's/app/node_modules, which is the trimmed copy from Next'soutput: 'standalone'trace:react-domwithoutclient.js,@swc/helperswith a handful of files instead of ~400. The startupnpm installtrustsnode_modules/.package-lock.jsonand never repairs those packages.Result:
next devfails withModule 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 laterdocker compose upwith only the default file runs the dev image.Fix
Give the built services their own local tags with
pull_policy: build:frontend→wardrowbe-frontend:devbackend,worker,image-worker→wardrowbe-backend:devDev 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:
Related Issue
None found. I searched open and closed issues and PRs for these symptoms.
Type of Change
Checklist
docker-compose.dev.yml)Testing
Test Environment
Tests Performed
nextjs) with standalone-trimmed contents, andGET /returned 500.docker compose -f docker-compose.yml -f docker-compose.dev.yml config --imagesnow lists onlywardrowbe-frontend:devandwardrowbe-backend:devfor the built services.npm ci, recreated the stack: all services run on the:devimages,GET /returns 200, the home page renders in the browser with no console errors.Additional Notes
pull_policy: buildmakesuprun 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:
Enhancements:
Build:
Documentation: