fix docker setup
This commit is contained in:
@@ -2,21 +2,21 @@ FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install dependencies
|
||||
# Copy package manifests and install dependencies (incl. workspaces)
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY apps/website/package.json apps/website/package.json
|
||||
RUN npm ci --workspaces --include-workspace-root
|
||||
|
||||
# Copy apps/website, packages, and config for building
|
||||
# Copy sources and config for building (monorepo)
|
||||
COPY apps/website apps/website/
|
||||
COPY packages core/
|
||||
COPY apps/website/tsconfig.json apps/website/
|
||||
COPY core core/
|
||||
COPY adapters adapters/
|
||||
COPY scripts scripts/
|
||||
COPY tsconfig.base.json ./
|
||||
|
||||
|
||||
# Build the Next.js application
|
||||
# Run from the root workspace context
|
||||
RUN node ./node_modules/next/dist/bin/next build
|
||||
# Build the Next.js application from the workspace
|
||||
RUN npm run env:website:merge && npm run build --workspace=@gridpilot/website
|
||||
|
||||
|
||||
# Production stage: slim image with only production dependencies and built files
|
||||
@@ -28,10 +28,11 @@ WORKDIR /app
|
||||
RUN apk add --no-cache wget
|
||||
|
||||
|
||||
# Copy package files and install production dependencies only
|
||||
# Copy package files and install production dependencies (incl. workspaces)
|
||||
COPY --from=builder /app/package.json ./
|
||||
COPY --from=builder /app/package-lock.json ./
|
||||
RUN npm ci --omit=dev
|
||||
COPY --from=builder /app/apps/website/package.json ./apps/website/package.json
|
||||
RUN npm ci --omit=dev --workspaces --include-workspace-root
|
||||
|
||||
# Copy built Next.js application
|
||||
COPY --from=builder /app/apps/website/.next ./apps/website/.next
|
||||
@@ -39,10 +40,8 @@ COPY --from=builder /app/apps/website/public ./apps/website/public
|
||||
COPY --from=builder /app/apps/website/package.json ./apps/website/package.json
|
||||
COPY --from=builder /app/apps/website/next.config.mjs ./apps/website/next.config.mjs
|
||||
|
||||
# Copy packages (needed for runtime dependencies)
|
||||
COPY --from=builder /app/packages ./packages
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
# Run Next.js in production mode from the root workspace context
|
||||
CMD ["node", "./node_modules/next/dist/bin/next", "start"]
|
||||
# Run Next.js in production mode (workspace context)
|
||||
CMD ["npm", "run", "start", "--workspace=@gridpilot/website"]
|
||||
Reference in New Issue
Block a user