Back to skills
SKILL.md
Docker Build
ASecurityCreates or optimizes a Dockerfile for the current project
- 10 stars
- 0 votes
- 0 copies
- 1 view
- Added June 1, 2026
Security analysis
100/100npx -y skills add berkcangumusisik/claude-code-practices --skill docker-build --agent claude-codeAre you the author of Docker Build?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/berkcangumusisik-docker-build)---
name: docker-build
description: Creates or optimizes a Dockerfile for the current project
user-invocable: true
allowed-tools: Read Glob Bash Edit
effort: medium
---
## Docker Setup
1. Detect project type:
```bash
cat package.json 2>/dev/null | grep '"main"\|"start"\|"scripts"' -A 5
ls -la | grep -E "Dockerfile|docker-compose|\.dockerignore"
```
2. If Dockerfile exists, review it for:
- Multi-stage build (build stage vs runtime stage)
- Layer caching order (dependencies before source)
- Running as non-root user
- `.dockerignore` completeness
- Image size optimization
3. If no Dockerfile, generate one following best practices:
```dockerfile
# Multi-stage: build → runtime
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
FROM node:20-alpine AS runtime
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
USER app
EXPOSE 3000
CMD ["node", "dist/index.js"]
```
4. Also create/update `.dockerignore`:
```
node_modules
dist
.env*
.git
coverage
*.test.*
```
5. Show `docker build` and `docker run` commands to test.
Attribution
Comments
Loading comments…