← ClaudeAtlas

dockerfilelisted

Generate or review Dockerfiles with multi-stage builds, security hardening, and optimized layer caching
SilviaAre95/wayworks · ★ 1 · Data & Documents · score 77
Install: claude install-skill SilviaAre95/wayworks
# Dockerfile Generate or review a Dockerfile for the app type in: **$ARGUMENTS** (mode defaults to create) ## Create Mode 1. **Analyze the project** — Read `package.json`, `requirements.txt`, `go.mod`, or `Cargo.toml` to understand dependencies and build steps. 2. **Generate a multi-stage Dockerfile**: ```dockerfile # Stage 1: Dependencies FROM node:20-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci --production=false # Stage 2: Build FROM node:20-alpine AS build WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build # Stage 3: Production FROM node:20-alpine AS production WORKDIR /app ENV NODE_ENV=production # Non-root user RUN addgroup -g 1001 -S appgroup && \ adduser -S appuser -u 1001 -G appgroup USER appuser COPY --from=build --chown=appuser:appgroup /app/dist ./dist COPY --from=build --chown=appuser:appgroup /app/node_modules ./node_modules COPY --from=build --chown=appuser:appgroup /app/package.json ./ EXPOSE 3000 CMD ["node", "dist/server.js"] ``` 3. **Generate `.dockerignore`**: ``` node_modules .git .env* *.md .next dist coverage ``` ## Review Mode Check for: 1. **Layer caching** — Are frequently changing layers at the bottom? 2. **Image size** — Using alpine/slim base? Multi-stage build? No dev dependencies in production? 3. **Security**: - Running as non-root user? - No secrets in build args or ENV? - Base image pinned to specific version (not `latest`)? - No unnecessary