Skip to content

Commit 0f1643e

Browse files
committed
fix(web): keep workspace node_modules after Docker prod install
1 parent 6c5d822 commit 0f1643e

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

apps/web/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY . .
1616
RUN bun install --frozen-lockfile
1717
RUN bun run --filter web build
1818

19-
# Minimal workspace manifest for the runtime image (web + packages the API imports).
19+
# Minimal workspace manifests for the runtime image (web + packages the API imports).
2020
# Strip devDependencies so bun does not require build-only workspace packages
2121
# like @bomberoscr/typescript-config during the production install.
2222
RUN apk add --no-cache jq && \
@@ -38,22 +38,28 @@ WORKDIR /app
3838
ENV NODE_ENV=production
3939
ENV PORT=3000
4040

41+
# Manifests first. Do not copy the monorepo bun.lock here — the slim workspace
42+
# does not match it, and BuildKit/bun will refuse to rewrite a frozen lockfile.
4143
COPY --from=build /tmp/root.package.json ./package.json
4244
COPY --from=build /tmp/web.package.json ./apps/web/package.json
4345
COPY --from=build /tmp/db.package.json ./packages/db/package.json
4446
COPY --from=build /tmp/lib.package.json ./packages/lib/package.json
4547
COPY --from=build /tmp/sync-domain.package.json ./packages/sync-domain/package.json
4648

47-
RUN bun install --production --ignore-scripts
48-
49+
# Runtime sources must be present BEFORE install so workspace links land correctly.
50+
# Do not copy package trees after install — that wipes bun's node_modules symlinks.
51+
COPY --from=build /app/packages/db/src ./packages/db/src
52+
COPY --from=build /app/packages/lib/src ./packages/lib/src
53+
COPY --from=build /app/packages/sync-domain/src ./packages/sync-domain/src
4954
COPY --from=build /app/apps/web/dist ./apps/web/dist
5055
COPY --from=build /app/apps/web/server.ts ./apps/web/server.ts
5156
COPY --from=build /app/apps/web/api ./apps/web/api
5257
COPY --from=build /app/apps/web/public ./apps/web/public
5358
COPY --from=build /app/apps/web/tsconfig.json ./apps/web/tsconfig.json
54-
COPY --from=build /app/packages/db ./packages/db
55-
COPY --from=build /app/packages/lib ./packages/lib
56-
COPY --from=build /app/packages/sync-domain ./packages/sync-domain
59+
60+
RUN bun install --production --ignore-scripts \
61+
&& bun --cwd apps/web -e 'import "drizzle-orm/node-postgres"; import "pg"; console.log("web deps ok")' \
62+
&& bun --cwd packages/db -e 'import "drizzle-orm/node-postgres"; console.log("db deps ok")'
5763

5864
WORKDIR /app/apps/web
5965

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web",
3-
"version": "0.1.39",
3+
"version": "0.1.40",
44
"private": true,
55
"type": "module",
66
"scripts": {

0 commit comments

Comments
 (0)