diff --git a/docker/gateway.Dockerfile b/docker/gateway.Dockerfile index dc678990..7b4cc7c8 100644 --- a/docker/gateway.Dockerfile +++ b/docker/gateway.Dockerfile @@ -10,6 +10,8 @@ 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 @@ -21,11 +23,17 @@ 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 -EXPOSE 4000 +# gateway defaults to port 14242 (apps/gateway/src/main.ts) +EXPOSE 14242 CMD ["node", "dist/main.js"]