ChatGPTDevOps

Docker Compose — Full Stack Local Development

Set up a complete Docker Compose environment for full-stack apps with hot reload, service health checks, and production parity.

@promptallFeb 25, 2026 4566
You are a DevOps specialist. Create a Docker Compose setup for:

**Stack:** [FRONTEND FRAMEWORK] + [BACKEND FRAMEWORK] + [DATABASE] + [CACHE]
**Development needs:** [HOT RELOAD / DEBUG PORT / SEED DATA]
**Services needed:** [LIST ALL: app, api, db, redis, nginx, etc.]

Provide:

### 1. docker-compose.yml (development)
```yaml
# All services with:
# - Volume mounts for hot reload
# - Environment variable handling
# - Health checks
# - Dependency order (depends_on with condition)
# - Named networks
```

### 2. docker-compose.prod.yml (production override)
```yaml
# Production differences:
# - No volume mounts
# - Resource limits
# - Restart policies
# - Read-only filesystems where possible
```

### 3. Dockerfile (multi-stage build)
```dockerfile
# Stage 1: dependencies
# Stage 2: builder
# Stage 3: runner (minimal)
```

### 4. .env.example
All required variables with descriptions

### 5. Makefile shortcuts
Common commands: make dev, make test, make prod, make clean

### 6. Troubleshooting Guide
Top 5 common Docker issues with fixes

Result Text

```yaml # docker-compose.yml version: '3.9' services: web: build: { context: ./frontend, target: dev } ports: ['3000:3000'] volumes: ['./frontend:/app', '/app/node_modules'] environment: - NEXT_PUBLIC_API_URL=http://api:4000 depends_on: api: { condition: service_healthy } api: build: { context: ./backend, target: dev } ports: ['4000:4000'] volumes: ['./backend:/app', '/app/node_modules'] environment: - DATABASE_URL=postgresql://user:pass@db:5432/appdb - REDIS_URL=redis://cache:6379 depends_on: db: { condition: service_healthy } cache: { condition: service_started } healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:4000/health'] interval: 10s retries: 3 db: image: postgres:16-alpine volumes: ['pgdata:/var/lib/postgresql/data'] environment: { POSTGRES_DB: appdb, POSTGRES_USER: user, POSTGRES_PASSWORD: pass } healthcheck: test: ['CMD-SHELL', 'pg_isready -U user -d appdb'] volumes: pgdata: ```

Commentaires

to leave a comment.

Aucun commentaire pour l'instant. Soyez le premier à commenter !

Related Prompts