ci/woodpecker/pr/ci Pipeline was successful
WorkspaceService shells out to git at runtime and roots workspaces at $MOSAIC_ROOT/.workspaces — the runner image had no git binary and no workspace directory. EXPOSE said 4000 but main.ts defaults to 14242. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ESFAnh2t9HmLwng8oW95St
40 lines
1.7 KiB
Docker
40 lines
1.7 KiB
Docker
FROM node:22-alpine AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
# Copy workspace manifests first for layer-cached install
|
|
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
|
|
COPY apps/gateway/package.json ./apps/gateway/
|
|
COPY packages/ ./packages/
|
|
COPY plugins/ ./plugins/
|
|
# the root prepare script runs scripts/install-hooks.mjs on install
|
|
COPY scripts/ ./scripts/
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY . .
|
|
# Build gateway and all of its workspace dependencies via turbo dependency graph
|
|
RUN pnpm turbo run build --filter @mosaicstack/gateway...
|
|
# Produce a self-contained deploy artifact: flat node_modules, no pnpm symlinks
|
|
# --legacy is required for pnpm v10 when inject-workspace-packages is not set
|
|
RUN pnpm --filter @mosaicstack/gateway --prod deploy --legacy /deploy
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
# WorkspaceService shells out to git at runtime and roots workspaces at
|
|
# $MOSAIC_ROOT/.workspaces (apps/gateway/src/workspace/workspace.service.ts);
|
|
# mount a volume over /opt/mosaic to persist workspaces across container restarts
|
|
RUN apk add --no-cache git && mkdir -p /opt/mosaic/.workspaces
|
|
ENV MOSAIC_ROOT=/opt/mosaic
|
|
# Use the pnpm deploy output — resolves all deps into a flat, self-contained node_modules
|
|
COPY --from=builder /deploy/node_modules ./node_modules
|
|
COPY --from=builder /deploy/package.json ./package.json
|
|
# dist is declared in package.json "files" so pnpm deploy copies it into /deploy;
|
|
# copy from builder explicitly as belt-and-suspenders
|
|
COPY --from=builder /app/apps/gateway/dist ./dist
|
|
# gateway defaults to port 14242 (apps/gateway/src/main.ts)
|
|
EXPOSE 14242
|
|
CMD ["node", "dist/main.js"]
|