Files
goodgo-platform/apps/web/Dockerfile
Ho Ngoc Hai 1c3dd305b8
Some checks failed
CI / E2E Tests (push) Has been skipped
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 20s
Deploy / Build API Image (push) Failing after 27s
Deploy / Build Web Image (push) Failing after 17s
Deploy / Build AI Services Image (push) Failing after 20s
E2E Tests / Playwright E2E (push) Failing after 22s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
fix: all 3 Dockerfiles — Prisma copy, standalone paths, maturin PATH
- API: copy .prisma + @prisma into pruned node_modules, restore dist/prisma COPY
- Web: fix standalone paths for monorepo (node_modules + apps/web/server.js)
- AI: source cargo env in same RUN layer, wrap fallback pip install in subshell

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-13 16:23:51 +07:00

49 lines
1.7 KiB
Docker

# ---- Base ----
FROM node:22-slim AS base
RUN corepack enable && corepack prepare pnpm@10.27.0 --activate
WORKDIR /app
# ---- Dependencies ----
FROM base AS deps
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json turbo.json ./
COPY apps/web/package.json apps/web/
RUN pnpm install --frozen-lockfile --filter @goodgo/web...
# ---- Build ----
FROM base AS build
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
COPY tsconfig.base.json ./
COPY apps/web/ apps/web/
RUN cd apps/web && npx next build
# ---- Production ----
FROM node:22-slim AS production
RUN apt-get update && apt-get install -y --no-install-recommends dumb-init && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
# Ensure public dir exists (may be empty) then copy Next.js standalone output
# In monorepo, standalone outputs to: .next/standalone/ (root with node_modules)
# and .next/standalone/apps/web/ (server.js + .next/)
RUN mkdir -p ./public
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/node_modules ./node_modules
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/apps/web ./
COPY --from=build --chown=node:node /app/apps/web/.next/static ./.next/static
# Copy public assets if any exist (may be empty)
COPY --from=build --chown=node:node /app/apps/web/public ./public
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "fetch('http://localhost:3000/api/health').then(r => { if (!r.ok) throw 1 }).catch(() => { process.exit(1) })"
USER node
ENTRYPOINT ["dumb-init", "--"]
CMD ["node", "server.js"]