Performance: Docker deployment for Vue apps
MEDIUM IMPACT
This affects the initial page load speed and caching efficiency by controlling how the Vue app is packaged and served inside a Docker container.
FROM node:18-alpine as build WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
FROM node:latest WORKDIR /app COPY . . RUN npm install RUN npm run build CMD ["npm", "run", "serve"]
| Pattern | Image Size | Startup Time | Serving Speed | Verdict |
|---|---|---|---|---|
| Node full image with dev server | ~900MB | Slow (seconds) | Slow (dynamic server) | [X] Bad |
| Multi-stage build with Nginx | ~30MB | Fast (milliseconds) | Fast (static files) | [OK] Good |