diff --git a/Dockerfile b/Dockerfile index 3860062..b0729ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,21 +39,19 @@ RUN echo "invalidate cache" && echo $(git rev-parse --short HEAD 2>/dev/null || NODE_OPTIONS='--max_old_space_size=2048' NEXT_TELEMETRY_DISABLED=1 pnpm run build # ---- Production Stage ---- -# Use Node 20 for production as well to match builder +# Use a smaller base image for production FROM node:20-alpine AS runner # Set working directory inside the container WORKDIR /app -# Install pnpm in production stage -RUN corepack enable && corepack prepare pnpm@latest --activate +# Copy the standalone build from builder +COPY --from=builder /app/.next/standalone ./ -RUN mkdir -p /app/public +# Copy static files +COPY --from=builder /app/.next/static ./.next/static -# Copy only necessary files from builder -COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./ -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules +# Copy public files COPY --from=builder /app/public ./public # Copy commit hash file from builder @@ -71,4 +69,4 @@ ENV API_HOSTNAME=internal-api.inboxi.ng # The file is available at /app/git_commit_sha if needed # Start Next.js server -CMD ["pnpm", "run", "start"] \ No newline at end of file +CMD ["node", "server.js"] \ No newline at end of file