docker
# Docker Infrastructure Skill
What this skill does
# Docker Infrastructure Skill
Production-ready Docker infrastructure for full-stack applications with FastAPI backend, Next.js frontend, and supporting services.
## When to Use This Skill
Use this skill when asked to:
- Set up Docker infrastructure for a project
- Configure multi-service Docker Compose environments
- Add new services to existing Docker infrastructure
- Configure nginx reverse proxy, monitoring, or SSL
## Architecture Overview
```
┌─────────────────────────────────────────────────────────────┐
│ Nginx (80/443) │
│ Reverse Proxy + SSL Termination │
└─────────────────────────┬───────────────────────────────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Frontend │ │ Backend API │ │ SignalR │
│ (Next.js) │ │ (FastAPI) │ │ (Real-time) │
│ :3010 │ │ :8000-8002 │ │ :5000 │
└───────────────┘ └───────┬───────┘ └───────────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ PostgreSQL │ │ Redis │ │ MinIO │
│ + PgBouncer│ │ (Cache/PubSub)│ │ (Object Store)│
│ :5432/:6432 │ │ :6379 │ │ :9000 │
└───────────────┘ └───────────────┘ └───────────────┘
│
▼
┌───────────────────┐
│ Celery Worker │
│ (Background Tasks)│
└───────────────────┘
│
▼
┌─────────────────┴─────────────────┐
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ Prometheus │ │ Grafana │
│ :9090 │─────────────────│ :3030 │
└───────────────┘ └───────────────┘
```
## Directory Structure
```
docker/
├── docker-compose.yml # Main compose file
├── backend/
│ ├── Dockerfile # FastAPI multi-stage build
│ └── .dockerignore
├── frontend/
│ ├── Dockerfile # Next.js build
│ └── .dockerignore
├── env/
│ ├── .env.example.backend # Backend env template
│ ├── .env.example.frontend # Frontend env template
│ ├── .env.example.postgres # Database env template
│ ├── .env.example.redis # Cache env template
│ ├── .env.example.minio # Object storage env template
│ ├── .env.example.coturn # TURN server env template
│ └── ENVIRONMENT_STRUCTURE.md
├── nginx/
│ ├── nginx.conf # Reverse proxy config
│ ├── ssl/ # SSL certificates
│ └── acme-challenge/ # Let's Encrypt
├── monitoring/
│ ├── prometheus/
│ │ ├── prometheus.yml
│ │ ├── alerts/
│ │ └── rules/
│ └── grafana/
│ └── provisioning/
├── coturn/
│ └── turnserver.conf # WebRTC TURN config
└── signalr-service/
├── Dockerfile
└── .dockerignore
```
## Core Services
### 1. PostgreSQL + PgBouncer
```yaml
# Database with connection pooling
postgres:
image: postgres:15-alpine
env_file:
- docker/env/.env.postgres
volumes:
- ~/workspace/docker/project/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5
pgbouncer:
image: edoburu/pgbouncer:latest
environment:
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
- POOL_MODE=transaction
- DEFAULT_POOL_SIZE=50
- MAX_CLIENT_CONN=500
depends_on:
postgres:
condition: service_healthy
```
### 2. Redis
```yaml
redis:
image: redis:7-alpine
command: >
sh -c 'redis-server
--maxmemory 2gb
--maxmemory-policy allkeys-lru
--appendonly yes
--notify-keyspace-events Ex
--maxclients 10000
--requirepass $$REDIS_PASSWORD'
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
```
### 3. FastAPI Backend (Scaled)
```yaml
backend-1:
build:
context: ./src/backend
dockerfile: ../../docker/backend/Dockerfile
environment:
- INSTANCE_ID=backend-1
env_file:
- docker/env/.env.backend
deploy:
resources:
limits:
cpus: '2'
memory: 2G
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
```
### 4. Celery Worker
```yaml
celery_worker:
build:
context: ./src/backend
dockerfile: ../../docker/backend/Dockerfile
command: celery -A celery_app worker --loglevel=info --concurrency=4 -Q celery,file_queue
env_file:
- docker/env/.env.backend
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
```
### 5. Nginx Reverse Proxy
```yaml
nginx:
image: nginx:alpine
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
ports:
- "80:80"
- "443:443"
```
## Environment Variable Strategy
### Single Source of Truth Pattern
```
Root .env (shared secrets)
├── POSTGRES_PASSWORD → Used by: postgres, backend
├── REDIS_PASSWORD → Used by: redis, backend, celery
├── JWT_SECRET_KEY → Used by: backend, frontend, signalr
└── SESSION_SECRET → Used by: backend, frontend
Service .env files reference shared vars:
# docker/env/.env.backend
DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
```
## Network Architecture
```yaml
networks:
# Main application network
app_network:
driver: bridge
# Isolated network for object storage (security)
minio_network:
driver: bridge
internal: true # No external connectivity
```
## Dockerfile Patterns
### Multi-Stage Python Build
```dockerfile
# Stage 1: Builder
FROM python:3.13-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
RUN apt-get update && apt-get install -y gcc g++ libpq-dev
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# Stage 2: Runtime
FROM python:3.13-slim
ENV PATH="/app/.venv/bin:$PATH"
RUN apt-get update && apt-get install -y libpq5 curl
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app /app
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
```
## Key Patterns
1. **Health Checks** - Every service has health checks for orchestration
2. **Resource Limits** - CPU and memory limits prevent runaway containers
3. **Dependency Conditions** - `depends_on` with `condition: service_healthy`
4. **Volume Persistence** - Data volumes for databases, uploads, logs
5. **Internal Networks** - Isolated networks for sensitive services
6. **Environment Substitution** - `${VAR}` references in env files
## References
See the `references/` directory for:
- `docker-compose-pattern.md` - Full compose file patterns
- `dockerfile-pattern.md` - Multi-stage build patterns
- `nginx-pattern.md` - Reverse proxy configuration
- `env-pattern.md` - Environment variable management
- `monitoring-pattern.md` - Prometheus/Grafana setup
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.