Skip to content

Fix Docker build: copy scripts/ and templates/ into the UI stage - #24

Merged
rowantrollope merged 1 commit into
mainfrom
fix/dockerfile-ui-build-context
Aug 4, 2026
Merged

rowantrollope merged 1 commit into
mainfrom
fix/dockerfile-ui-build-context

Conversation

@jeremyplichta

Copy link
Copy Markdown
Contributor

Problem

docker build . fails on a clean checkout.

The ui-builder stage sets WORKDIR /build/ui and copies only ui/, but ui/package.json runs a prebuild step that reaches outside that directory:

"prebuild": "npm run templates:generate",
"templates:generate": "node ../scripts/generate-template-data.mjs"

From /build/ui that resolves to /build/scripts/generate-template-data.mjs, which is never copied in:

> node ../scripts/generate-template-data.mjs
Error: Cannot find module '/build/scripts/generate-template-data.mjs'

Adding scripts/ alone is not sufficient — the generator then walks the repo-root templates/ tree:

Error: ENOENT: no such file or directory, scandir '/build/templates'

This also affects docker compose up, which the README documents as the self-managed path, since the afs service builds from this Dockerfile.

Fix

Copy both directories into the UI build stage. Two lines, no behaviour change.

Verification

Built on linux/arm64 from a clean checkout:

  • image builds successfully
  • GET /healthz200
  • GET / 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

`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>
@rowantrollope
rowantrollope merged commit 3100b31 into main Aug 4, 2026
5 checks passed
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.

2 participants