Task #587: Fix Docker build — copy version.json into build stage

The api-server docker build failed on the Mac with:
  ERROR: Could not resolve "../../../../version.json"
  src/routes/system.ts:4

`version.json` lives at the repo root and is tracked in git, but
`docker/api-server.Dockerfile` never copied it into the `build` stage,
so esbuild (running in /app/artifacts/api-server) couldn't resolve the
`../../../../version.json` import added by commit 80429920.

Fix: added `COPY version.json ./` in the build stage, right after the
tsconfig copy and before `lib`/`scripts`/`artifacts` are copied. No
runtime change is needed — esbuild inlines the JSON into the bundle
via the `with { type: "json" }` import attribute, so the runtime stage
does not need the file on disk.

Local dev (`pnpm --filter @workspace/api-server run dev`) is
unaffected because it builds outside Docker against the real repo
root. tx-os Dockerfile not touched.

Mac side after pulling this commit:
  cd ~/Downloads/TX && git pull && docker compose up -d --build api
This commit is contained in:
riyadhafraa
2026-05-18 09:54:14 +00:00
parent 7b94653f5e
commit b2f500500e
+1
View File
@@ -33,6 +33,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
FROM deps AS build
COPY tsconfig.base.json* tsconfig.json* ./
COPY version.json ./
COPY lib lib
COPY scripts scripts
COPY artifacts/api-server artifacts/api-server