Performance: Docker deployment
MEDIUM IMPACT
Docker deployment affects page load speed by controlling how the Next.js app is packaged, started, and served in a container environment.
FROM node:18-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build RUN npm prune --production FROM node:18-alpine WORKDIR /app COPY --from=builder /app/.next ./.next COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/package.json ./ COPY --from=builder /app/public ./public COPY --from=builder /app/next.config.js ./next.config.js EXPOSE 3000 CMD ["npm", "start"]
FROM node:18 WORKDIR /app COPY . . RUN npm install RUN npm run build CMD ["npm", "start"]
| Pattern | Image Size | Startup Time | Resource Use | Verdict |
|---|---|---|---|---|
| Single-stage build with full dependencies | 300MB+ | 5-10s | High CPU and memory | [X] Bad |
| Multi-stage build with production deps only | 90MB | 1-2s | Low CPU and memory | [OK] Good |