Performance: Docker deployment
Docker deployment affects page load speed by controlling how the Astro app is packaged and served, impacting server response time and resource loading.
FROM node:18-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build RUN npm prune --production FROM node:18-alpine WORKDIR /app COPY --from=builder /app/dist ./dist COPY --from=builder /app/node_modules ./node_modules CMD ["node", "dist/server/entry.mjs"]
FROM node:latest WORKDIR /app COPY . . RUN npm install RUN npm run build CMD ["npm", "start"]
| Pattern | Image Size | Startup Time | Resource Use | Verdict |
|---|---|---|---|---|
| Full node image with all files | 300MB+ | 10+ seconds | High CPU and memory | [X] Bad |
| Multi-stage build with alpine base | 90MB | Under 3 seconds | Low CPU and memory | [OK] Good |
FROM node:18 AS builder WORKDIR /app COPY package.json . RUN npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html
FROM node:18 WORKDIR /app COPY package.json . RUN npm install COPY . . RUN npm run build CMD ["npm", "start"]What is the likely cause?
Pass the test and this pattern moves unknown