template-saas/docker-compose.yml
Adrian Flores Cortes e7767e03be
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[template-saas] refactor(structure): Migrate to canonical apps/ structure (ADR-0011)
- Moved backend/ submodule to apps/backend/
- Moved frontend/ submodule to apps/frontend-web/ (canonical naming)
- Moved database/ submodule to apps/database/
- Updated docker-compose.yml frontend path to apps/frontend-web
- Updated CLAUDE.md v2.0.0 with canonical structure and aliases
- Created apps/_MAP.md with component index
- Updated MASTER_INVENTORY.yml paths (13 references)

Part of: TASK-2026-02-06-ESTANDARIZACION-ESTRUCTURA-PROYECTOS (Sprint 2)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 10:14:32 -06:00

115 lines
3.1 KiB
YAML

version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: template-saas-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-template_saas_user}
POSTGRES_PASSWORD: ${DB_PASSWORD:-template_saas_dev_2026}
POSTGRES_DB: ${DB_NAME:-template_saas_dev}
ports:
- "${DB_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./apps/database/ddl:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-template_saas_user} -d ${DB_NAME:-template_saas_dev}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- template-saas-network
# Redis Cache
redis:
image: redis:7-alpine
container_name: template-saas-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- template-saas-network
# Backend API
backend:
build:
context: ./apps/backend
dockerfile: Dockerfile
container_name: template-saas-backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NODE_ENV: ${NODE_ENV:-development}
PORT: 3001
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: ${DB_NAME:-template_saas_dev}
DB_USER: ${DB_USER:-template_saas_user}
DB_PASSWORD: ${DB_PASSWORD:-template_saas_dev_2026}
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:-dev-jwt-secret-change-in-production}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-15m}
JWT_REFRESH_EXPIRES_IN: ${JWT_REFRESH_EXPIRES_IN:-7d}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:3000}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-}
ports:
- "${API_PORT:-3001}:3001"
volumes:
- ./apps/backend/src:/app/src:ro
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- template-saas-network
# Frontend App (production build served by nginx)
frontend:
build:
context: ./apps/frontend-web
dockerfile: Dockerfile
args:
VITE_API_URL: ${VITE_API_URL:-http://localhost:3001}
container_name: template-saas-frontend
restart: unless-stopped
depends_on:
- backend
ports:
- "${APP_PORT:-3000}:80"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- template-saas-network
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
template-saas-network:
driver: bridge