Really huge mass update; Getting everything up-to-spec and implementing a wide range of features
This commit is contained in:
+16
-11
@@ -8,7 +8,7 @@ WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
COPY frontend/package.json ./frontend/
|
||||
COPY backend/package.json ./backend/
|
||||
COPY prisma/ ./prisma/
|
||||
COPY prisma/schema.prisma ./prisma/schema.prisma
|
||||
|
||||
# corepack activates the exact pnpm version declared in package.json#packageManager.
|
||||
# This is hash-verified (sha1) and prevents newer pnpm from applying different
|
||||
@@ -17,28 +17,33 @@ COPY prisma/ ./prisma/
|
||||
RUN corepack enable && corepack install && \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build frontend
|
||||
# Stage 2: Prune runtime dependencies
|
||||
FROM deps AS prod-deps
|
||||
COPY prisma/ ./prisma/
|
||||
RUN CI=true pnpm prune --prod
|
||||
|
||||
# Stage 3: Build frontend
|
||||
FROM deps AS frontend-builder
|
||||
COPY frontend/ ./frontend/
|
||||
RUN pnpm --filter pp-frontend run build
|
||||
|
||||
# Stage 3: Build backend + Prisma client
|
||||
# Stage 4: Build backend + Prisma client
|
||||
FROM deps AS backend-builder
|
||||
COPY backend/ ./backend/
|
||||
COPY prisma/ ./prisma/
|
||||
RUN pnpm --filter pp-backend run generate && \
|
||||
pnpm --filter pp-backend run build
|
||||
pnpm --filter pp-backend run build:prod
|
||||
|
||||
# Stage 4: Minimal production runner
|
||||
# Stage 5: Minimal production runner
|
||||
FROM node:24-alpine AS runner
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache openssl
|
||||
ENV NODE_PATH=/app/node_modules/.pnpm/node_modules
|
||||
|
||||
# Root node_modules contains prisma CLI and hoisted deps; backend node_modules has
|
||||
# the backend-specific symlinks. Both are needed at runtime.
|
||||
COPY --from=backend-builder /app/node_modules ./node_modules
|
||||
COPY --from=prod-deps /app/node_modules ./node_modules
|
||||
COPY --from=prod-deps /app/backend/node_modules ./backend/node_modules
|
||||
COPY --from=prod-deps /app/backend/package.json ./backend/package.json
|
||||
COPY --from=backend-builder /app/backend/dist ./backend/dist
|
||||
COPY --from=backend-builder /app/backend/node_modules ./backend/node_modules
|
||||
COPY --from=backend-builder /app/backend/package.json ./backend/package.json
|
||||
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
||||
COPY prisma/ ./prisma/
|
||||
|
||||
@@ -46,4 +51,4 @@ WORKDIR /app/backend
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD sh -c "../node_modules/.bin/prisma migrate deploy --schema=../prisma/schema.prisma && node dist/index.js"
|
||||
CMD sh -c "../node_modules/.pnpm/node_modules/.bin/prisma migrate deploy --schema=../prisma/schema.prisma && node dist/index.js"
|
||||
|
||||
Reference in New Issue
Block a user