docker-compose-generatorlisted
Install: claude install-skill timwukp/agent-skills-best-practice
# Docker Compose Generator
## Instructions
### Step 1: Identify the Stack
Ask:
1. What language/runtime? (Node.js, Python, Java, Go, Ruby, .NET)
2. What framework? (Express, FastAPI, Spring Boot, Gin, Rails)
3. What services are needed? (database, cache, message queue, search)
4. Is this for development, production, or both?
5. Any existing Dockerfile to improve?
### Step 2: Generate Multi-Stage Dockerfile
Use multi-stage builds to minimize image size:
**Node.js example:**
```dockerfile
# Stage 1: Dependencies
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
# Stage 2: Build
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 3: Production
FROM node:20-alpine AS production
RUN addgroup -g 1001 -S appgroup && \
adduser -S appuser -u 1001 -G appgroup
WORKDIR /app
COPY --from=deps --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=build --chown=appuser:appgroup /app/dist ./dist
COPY --from=build --chown=appuser:appgroup /app/package.json ./
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/index.js"]
```
**Python example:**
```dockerfile
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
FROM base AS deps
WORKDIR /app
COPY requirements.txt .
RUN p