infrastructure/docker-compose-generator/SKILL.md
Generate multi-service Docker Compose files with common stacks (app + DB + Redis + Nginx), volumes, networks, healthchecks, depends_on, environment variables, and profiles.
npx skillsauth add achreftlili/deep-dev-skills docker-compose-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate multi-service Docker Compose files with common stacks (app + DB + Redis + Nginx), volumes, networks, healthchecks, depends_on, environment variables, and profiles.
# Initialize a compose file in the project root
touch docker-compose.yml
touch .env
# Optional: create override for local dev
touch docker-compose.override.yml
project-root/
docker-compose.yml # Base services (production-like)
docker-compose.override.yml # Dev overrides (auto-loaded with docker compose up)
docker-compose.prod.yml # Production overrides
.env # Default env vars for compose
.env.example # Committed template
nginx/
nginx.conf # Reverse proxy config
certs/ # Local SSL certs (gitignored)
docker/
app/
Dockerfile # Application Dockerfile
worker/
Dockerfile # Background worker Dockerfile
docker compose, not docker-compose).docker-compose.yml per project root. Use override files for environment-specific config..env files or Docker secrets.postgres:16-alpine, not postgres:latest).depends_on.condition: service_healthy works.profiles to group optional services (e.g., monitoring, debug tools).docker-compose.yml)name: myapp
services:
app:
build:
context: .
dockerfile: docker/app/Dockerfile
target: development
ports:
- "${APP_PORT:-3000}:3000"
environment:
NODE_ENV: development
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-secret}@db:5432/${POSTGRES_DB:-myapp}
REDIS_URL: redis://redis:6379
volumes:
- .:/app
- /app/node_modules
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- backend
db:
image: postgres:16-alpine
ports:
- "${DB_PORT:-5432}:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-app}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret}
POSTGRES_DB: ${POSTGRES_DB:-myapp}
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-app}"]
interval: 5s
timeout: 3s
retries: 5
networks:
- backend
redis:
image: redis:7-alpine
ports:
- "${REDIS_PORT:-6379}:6379"
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- backend
nginx:
image: nginx:1.27-alpine
ports:
- "${NGINX_PORT:-80}:80"
- "${NGINX_SSL_PORT:-443}:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- app
networks:
- backend
# Optional services — only start with: docker compose --profile monitoring up
adminer:
image: adminer:4
ports:
- "8080:8080"
depends_on:
- db
profiles:
- debug
networks:
- backend
redis-commander:
image: rediscommander/redis-commander:latest
environment:
REDIS_HOSTS: local:redis:6379
ports:
- "8081:8081"
profiles:
- debug
networks:
- backend
volumes:
pg_data:
redis_data:
networks:
backend:
driver: bridge
docker-compose.prod.yml)services:
app:
build:
target: production
ports: []
volumes: []
environment:
NODE_ENV: production
restart: unless-stopped
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
db:
ports: []
restart: unless-stopped
redis:
ports: []
restart: unless-stopped
nginx:
restart: unless-stopped
.env.example)# Application
APP_PORT=3000
NODE_ENV=development
# Database
POSTGRES_USER=app
POSTGRES_PASSWORD=secret
POSTGRES_DB=myapp
DB_PORT=5432
# Redis
REDIS_PORT=6379
# Nginx
NGINX_PORT=80
NGINX_SSL_PORT=443
services:
worker:
build:
context: .
dockerfile: docker/worker/Dockerfile
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-secret}@db:5432/${POSTGRES_DB:-myapp}
REDIS_URL: redis://redis:6379
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
deploy:
replicas: 2
networks:
- backend
services:
db:
image: mysql:8.4
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootsecret}
MYSQL_DATABASE: ${MYSQL_DATABASE:-myapp}
MYSQL_USER: ${MYSQL_USER:-app}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-secret}
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s
timeout: 3s
retries: 5
ports:
- "${DB_PORT:-3306}:3306"
services:
mongo:
image: mongo:7
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER:-admin}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD:-secret}
MONGO_INITDB_DATABASE: ${MONGO_DB:-myapp}
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 3s
retries: 5
ports:
- "${MONGO_PORT:-27017}:27017"
# Start all services (uses docker-compose.yml + docker-compose.override.yml)
docker compose up -d
# Start with debug tools
docker compose --profile debug up -d
# Start with production overrides
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# View logs (follow)
docker compose logs -f app
# Rebuild after Dockerfile changes
docker compose up -d --build app
# Stop all services
docker compose down
# Stop and remove volumes (full reset)
docker compose down -v
# Execute command in running container
docker compose exec app sh
docker compose exec db psql -U app myapp
# View service status
docker compose ps
# Scale a service
docker compose up -d --scale worker=3
dockerfile-generator skill to create optimized per-language Dockerfiles referenced in build.dockerfile.nginx-config-generator skill for the reverse proxy config mounted into the nginx service.github-actions-ci skill to build and push images in CI, then deploy with compose on the target host.kubernetes-manifests skill. Compose is best for local dev and small deployments..env files.testing
Set up Vitest 2.x with TypeScript for unit and component testing using test/describe/it, vi.fn/vi.mock/vi.spyOn, component testing with Testing Library, coverage (v8/istanbul), workspace config, and snapshot testing.
testing
Set up pytest 8.x with Python for unit and integration testing using fixtures (scope, autouse, parametrize), async tests (pytest-asyncio), mocking (unittest.mock, pytest-mock), coverage (pytest-cov), conftest.py patterns, and markers.
testing
Set up Playwright 1.49+ with TypeScript for E2E testing using page object model, fixtures, test.describe/test blocks, assertions, selectors, network mocking, CI configuration, and trace viewer.
testing
Set up Jest 30+ with TypeScript for unit tests, integration tests, mocking (jest.fn, jest.mock, jest.spyOn), coverage configuration, custom matchers, snapshot testing, and setup/teardown patterns.