Skip to content

fix(docker): use repo root as build context so shared/ is available to both tiers - #2219

Merged
trillium merged 6 commits into
developmentfrom
fix/shared-files-docker-build-context
Oct 6, 2026
Merged

trillium merged 6 commits into
developmentfrom
fix/shared-files-docker-build-context

Conversation

@mvill025

@mvill025 mvill025 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #2229

Related: #2230 (the AWS deploy workflows still build from the per-tier context and need the same fix).

What changes did you make and why did you make them ?

shared/ lives at the repo root and is imported by both the client and the backend, but the Docker builds used ./client and ./backend as their build contexts — so shared/ was never copied into either image and the builds failed on the missing imports.

  • Moved both build contexts to the repo root (docker-compose.yml, .github/workflows/all-merges.yaml) and updated every COPY path in backend/Dockerfile.api, client/Dockerfile.client, and client/Dockerfile.prod to be root-relative. shared/ is now copied to /srv/shared in both images.
  • Added ./shared:/srv/shared as a volume on the client service so dev-mode hot reload picks up changes to shared code (the backend service already mounted the repo differently).
  • Added a @shared alias in client/vite.config.mjs pointing at <repoRoot>/shared, plus server.fs.allow: [repoRoot] so the Vite dev server is permitted to serve files outside its root.
  • Replaced the relative shared/ imports in Navbar.jsx, selectProject.jsx, EditUsers.jsx, authContext.jsx, and ProjectList.jsx with @shared/.... These previously varied by nesting depth (../../../shared vs ../../../../shared), which is what made them fragile in the first place.
  • Incidental: FROM nginx as → FROM nginx AS in Dockerfile.client to clear the Docker build warning, and Prettier formatting on the touched client files.

How to test

docker compose build --no-cache
docker compose up

Both images should build, and the client should resolve @shared/roles / @shared/authorizationUtils in dev and in the production (nginx) target.

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

No user-facing visual changes — build configuration and import paths only.

🤖 Generated with Claude Code

@mvill025
mvill025 requested a review from trillium October 2, 2026 02:46

@trillium trillium left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change, lets us use @ imports properly

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.

Docker builds fail: shared/ is outside both build contexts

2 participants