98 lines
2.9 KiB
YAML
98 lines
2.9 KiB
YAML
# ============================================================================
|
|
# 🐳 Task Manager - Docker Compose
|
|
# ============================================================================
|
|
# Orquestra múltiplos serviços:
|
|
# - backend: NestJS API
|
|
# - postgres: Banco de dados (opcional, para desenvolvimento local)
|
|
# ============================================================================
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# ============================================================================
|
|
# BACKEND - NestJS API
|
|
# ============================================================================
|
|
backend:
|
|
build:
|
|
context: ./backend-api
|
|
dockerfile: Dockerfile
|
|
|
|
container_name: todolist-backend
|
|
|
|
ports:
|
|
- "3000:3000"
|
|
|
|
environment:
|
|
# ⚠️ IMPORTANTE: Use arquivo .env em produção, não em docker-compose
|
|
NODE_ENV: development
|
|
PORT: 3000
|
|
API_PREFIX: /api
|
|
# Supabase (substitua com seus valores reais)
|
|
SUPABASE_URL: ${SUPABASE_URL:-https://seu-projeto.supabase.co}
|
|
SUPABASE_ANON_KEY: ${SUPABASE_ANON_KEY:-sua-anon-key}
|
|
SUPABASE_SERVICE_KEY: ${SUPABASE_SERVICE_KEY:-sua-service-key}
|
|
JWT_SECRET: ${JWT_SECRET:-sua-chave-secreta-de-32-caracteres-minimo}
|
|
JWT_EXPIRATION: 7d
|
|
|
|
# Volumes para desenvolvimento (hot reload)
|
|
volumes:
|
|
- ./backend-api/src:/app/src
|
|
- ./backend-api/dist:/app/dist
|
|
|
|
# Health check
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/api"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
# Logging
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
# Reiniciar automaticamente em caso de crash
|
|
restart: unless-stopped
|
|
|
|
# Redes
|
|
networks:
|
|
- todolist-network
|
|
|
|
# ============================================================================
|
|
# POSTGRES (Opcional - se usar Supabase local)
|
|
# ============================================================================
|
|
# postgres:
|
|
# image: postgres:16-alpine
|
|
# container_name: todolist-postgres
|
|
#
|
|
# environment:
|
|
# POSTGRES_USER: postgres
|
|
# POSTGRES_PASSWORD: postgres123
|
|
# POSTGRES_DB: todolist
|
|
#
|
|
# ports:
|
|
# - "5432:5432"
|
|
#
|
|
# volumes:
|
|
# - postgres-data:/var/lib/postgresql/data
|
|
#
|
|
# networks:
|
|
# - todolist-network
|
|
|
|
# ============================================================================
|
|
# VOLUMES (dados persistentes)
|
|
# ============================================================================
|
|
volumes:
|
|
postgres-data:
|
|
driver: local
|
|
|
|
# ============================================================================
|
|
# NETWORKS (comunicação entre serviços)
|
|
# ============================================================================
|
|
networks:
|
|
todolist-network:
|
|
driver: bridge
|