Skip to content

Dockerfile: copy the shared backend crate into the image build - #220

Merged
eetu merged 1 commit into
mainfrom
docker-shared-crate
Aug 12, 2026
Merged

Dockerfile: copy the shared backend crate into the image build#220
eetu merged 1 commit into
mainfrom
docker-shared-crate

Conversation

@eetu

@eetu eetu commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Create and publish Docker images has been failing on main since #217, with:

error: failed to load manifest for workspace member `/app/apps/tracker/backend`
Caused by: failed to load manifest for dependency `scene-backend`
Caused by: failed to read `/app/crates/scene-backend/Cargo.toml`

Not caused by #217 — the Dockerfile has been wrong since crates/scene-backend landed in #213, and the workspace-deps layer was simply cached until something invalidated it. Two omissions:

  1. The cache-warm stage copied four crate manifests but not crates/scene-backend/Cargo.toml. Cargo parses the whole workspace before building any of it, so a member whose manifest it cannot read is fatal — regardless of which packages -p names.
  2. No stage copied that crate's real src. So even with the manifest present, the three backends would have compiled against the empty stub lib and failed on every item they use.

The manifest and a stub lib join the warm stage; the real source lands in one shared-build stage that all three backend stages now extend, so a change to the shared crate rebuilds the three of them off the same layer.

Verified two ways. Locally without a container: reproducing the stage's exact copy set in a temp dir reproduces that identical cargo error, and adding the manifest makes cargo metadata parse. Then for real — this workflow is push: [main] only, so I dispatched it on this branch: all three images (tracker, party, transcoder) built and pushed green. That run left throwaway :docker-shared-crate tags in GHCR; I'll delete them once this merges.

The image build has been broken since scene-backend landed; it only surfaced now
because the workspace-deps layer was cached until something invalidated it.

Two omissions. The cache-warm stage copied four manifests but not
crates/scene-backend/Cargo.toml — and cargo parses the WHOLE workspace before
building any of it, so a member whose manifest it cannot read is a hard error
("failed to load manifest for workspace member … failed to read
crates/scene-backend/Cargo.toml"). And no stage copied that crate's real source,
so once the manifest was there the backends would have compiled against an empty
stub lib and failed on every item they use.

The manifest and a stub lib join the warm stage; the real source lands in one
shared-build stage that all three backend stages now extend, so a change to the
shared crate rebuilds the three of them from the same layer.

Verified the failing step locally without a container: reproducing the stage's
exact copy set in a temp dir makes cargo emit that identical error, and adding the
manifest makes it parse.
@eetu
eetu merged commit 039792f into main Aug 12, 2026
10 checks passed
@eetu
eetu deleted the docker-shared-crate branch August 12, 2026 04:36
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.

1 participant