fix: all 3 Dockerfiles — Prisma copy, standalone paths, maturin PATH
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

- 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>
This commit is contained in:
Ho Ngoc Hai
2026-04-13 16:23:51 +07:00
parent 39bb6bc911
commit 1c3dd305b8
3 changed files with 12 additions and 10 deletions

View File

@@ -36,7 +36,9 @@ RUN npx prisma generate \
# Use pnpm deploy to produce a flat, production-only node_modules
# This strips devDependencies and hoists only what @goodgo/api needs.
RUN pnpm deploy --legacy --filter @goodgo/api --prod /app/pruned
RUN pnpm deploy --legacy --filter @goodgo/api --prod /app/pruned \
&& cp -r /app/node_modules/.prisma /app/pruned/node_modules/.prisma \
&& cp -r /app/node_modules/@prisma /app/pruned/node_modules/@prisma
# ---- Production ----
FROM node:22-slim AS production
@@ -55,15 +57,12 @@ WORKDIR /app
ENV NODE_ENV=production
# Copy pruned production node_modules from pnpm deploy
# Copy pruned production node_modules from pnpm deploy (includes Prisma)
COPY --from=build --chown=node:node /app/pruned/node_modules ./node_modules
# Copy compiled application
COPY --from=build --chown=node:node /app/apps/api/dist ./dist
# Prisma schema + migrations (needed for runtime client & migrate deploy)
COPY --from=build --chown=node:node /app/prisma ./prisma
# Copy generated Prisma client into node_modules
COPY --from=build --chown=node:node /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=build --chown=node:node /app/node_modules/@prisma/client ./node_modules/@prisma/client
# Package metadata
COPY --from=build --chown=node:node /app/apps/api/package.json ./package.json
# Entrypoint script

View File

@@ -28,8 +28,11 @@ 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 ./
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

View File

@@ -7,11 +7,11 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends gcc g++ dumb-init curl && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal && \
rm -rf /var/lib/apt/lists/*
ENV PATH="/root/.cargo/bin:${PATH}"
COPY pyproject.toml .
RUN pip install --no-cache-dir maturin && \
pip install --no-cache-dir . 2>/dev/null || pip install --no-cache-dir \
RUN . /root/.cargo/env && \
pip install --no-cache-dir maturin && \
(pip install --no-cache-dir . 2>/dev/null || pip install --no-cache-dir \
"fastapi==0.115.0" \
"uvicorn[standard]==0.32.0" \
"xgboost==2.1.0" \
@@ -20,7 +20,7 @@ RUN pip install --no-cache-dir maturin && \
"pydantic==2.9.0" \
"pydantic-settings==2.5.0" \
"httpx==0.27.0" \
"slowapi==0.1.9"
"slowapi==0.1.9")
COPY app/ ./app/