Loading...
Loading...
Generate Compose configs with services, networking, volumes, and health checks
npx skill4agent add mwguerra/claude-code-plugins docker-compose03-compose-fundamentals.md04-networking.md05-databases.md06-services.md08-volumes.md# Modern compose (no version field)
services:
app:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
depends_on:
db:
condition: service_healthy
networks:
- frontend
- backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- backend
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data:
networks:
frontend:
backend:
internal: trueservices:
web:
build: .
ports:
- "80:80"
depends_on:
- apiservices:
api:
build: ./api
expose:
- "3000"
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/app
depends_on:
db:
condition: service_healthyservices:
db:
image: postgres:16-alpine
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
retries: 5services:
redis:
image: redis:7-alpine
command: redis-server --appendonly yes
volumes:
- redis_data:/dataservices:
worker:
build: .
command: npm run worker
depends_on:
- db
- redisnetworks:
backend:
internal: true # No external accessnetworks:
proxy:
external: true
name: traefik_proxyvolumes:
postgres_data:volumes:
- ./src:/app/srcvolumes:
- /app/node_modulesenvironment:
- NODE_ENV=productionenv_file:
- .envenvironment:
- DB_HOST=${DB_HOST:-localhost}