1.2 KiB
1.2 KiB
name, description, triggers
| name | description | triggers | |||
|---|---|---|---|---|---|
| Dockerfile Generator | Generates a production-ready multi-stage Dockerfile for a Vite + React build, optimized for small image size and caching. |
|
Dockerfile Generator
Purpose
- Produce a multi-stage Dockerfile that builds the Vite project and serves the generated
distwith nginx (recommended) or any static server.
Example prompts
- "create Dockerfile for production build"
- "generate multi-stage Dockerfile with nginx"
Sample Dockerfile
# builder
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --production=false
COPY . .
RUN npm run build
# production image
FROM nginx:stable-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Notes
- If the app needs server-side APIs, recommend building a separate backend image and using docker-compose.
- Provide guidance for
VITE_BASE_URLor--baseduring build if app is served from a subpath (e.g., GitHub Pages). - Suggest using build cache layers (copy package.json first) to speed CI builds.