Fix Docker build: copy scripts/ and templates/ into the UI stage - #24
Merged
Merged
Conversation
`docker build .` currently fails. The ui-builder stage sets WORKDIR /build/ui and
copies only ui/, but ui/package.json has:
"prebuild": "npm run templates:generate"
"templates:generate": "node ../scripts/generate-template-data.mjs"
which resolves to /build/scripts/generate-template-data.mjs. That path is never
copied into the image, so the build fails before vite runs:
Error: Cannot find module '/build/scripts/generate-template-data.mjs'
Adding scripts/ alone is not enough: the generator then walks the repo-root
templates/ tree and fails with
Error: ENOENT: no such file or directory, scandir '/build/templates'
Copying both fixes the build. Verified end to end on linux/arm64: the image
builds, `/healthz` returns 200, and `/` serves the embedded UI, so the generated
template data and vite output are both embedded correctly.
This also affects `docker compose up`, which the README documents as the
self-managed path, since the afs service builds from this Dockerfile.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docker build .fails on a clean checkout.The
ui-builderstage setsWORKDIR /build/uiand copies onlyui/, butui/package.jsonruns a prebuild step that reaches outside that directory:From
/build/uithat resolves to/build/scripts/generate-template-data.mjs, which is never copied in:Adding
scripts/alone is not sufficient — the generator then walks the repo-roottemplates/tree:This also affects
docker compose up, which the README documents as the self-managed path, since theafsservice builds from this Dockerfile.Fix
Copy both directories into the UI build stage. Two lines, no behaviour change.
Verification
Built on
linux/arm64from a clean checkout:GET /healthz→200GET /serves the embedded UI (<!doctype html>with the Redis AFS favicon)Both the generated template data and the vite output end up embedded correctly, so this exercises the whole path rather than just getting past the failing step.
Notes
Found while building an AFS deployment for Kubernetes, where I needed a control-plane image. I had to carry a patched copy of this Dockerfile downstream; this removes that need.
🤖 Generated with Claude Code