Skip to content

Fix static assets 404 in Docker image - #15

Merged
CampingAvocado merged 1 commit into
CampingAvocado:mainfrom
blarsen:fix/docker-assets-path
Oct 1, 2026
Merged

CampingAvocado merged 1 commit into
CampingAvocado:mainfrom
blarsen:fix/docker-assets-path

Conversation

@blarsen

@blarsen blarsen commented Sep 30, 2026

Copy link
Copy Markdown

Summary

  • The app stage of the Dockerfile copies assets to /server/assets but places the binary at the image root (/mlm). resolve_assets_dir() (server/src/web/mod.rs) falls back to a directory next to the executable (/assets) and, failing that, the compile-time CARGO_MANIFEST_DIR path baked in during the build stage (/app/server/assets) — neither exists in the final image, so ServeDir gets a nonexistent root and every /assets/* request (style.css, elements.js, index.js, favicon, icons) 404s, leaving the UI completely unstyled.
  • Fix by setting MLM_ASSETS_DIR=/server/assets explicitly in the Dockerfile, matching the actual COPY destination.

Test plan

  • Rebuilt the image locally (docker compose build), restarted the container, and confirmed the "Static assets directory does not exist" warning is gone from the logs and /assets/style.css, /assets/elements.js, /assets/index.js all return 200 instead of 404.

🤖 Generated with Claude Code

The final image copies assets to /server/assets but the binary sits
at image root (/mlm), so resolve_assets_dir()'s exe-relative fallback
looks in /assets, and the compile-time CARGO_MANIFEST_DIR fallback
points at a build-stage-only path. Neither exists at runtime, so
ServeDir has no root and every /assets/* request 404s.

Set MLM_ASSETS_DIR explicitly to the path assets are actually copied
to.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@blarsen blarsen mentioned this pull request Sep 30, 2026
@CampingAvocado
CampingAvocado merged commit 7d5141a into CampingAvocado:main Oct 1, 2026
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