workspace-v1/control-plane/devtools/docker/templates/docker-compose.fullstack.yml
Adrian Flores Cortes 967ab360bb Initial commit: Workspace v1 with 3-layer architecture
Structure:
- control-plane/: Registries, SIMCO directives, CI/CD templates
- projects/: Gamilit, ERP-Suite, Trading-Platform, Betting-Analytics
- shared/: Libs catalog, knowledge-base

Key features:
- Centralized port, domain, database, and service registries
- 23 SIMCO directives + 6 fundamental principles
- NEXUS agent profiles with delegation rules
- Validation scripts for workspace integrity
- Dockerfiles for all services
- Path aliases for quick reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:35:19 -06:00

125 lines
3.6 KiB
YAML

# ==============================================================================
# DOCKER COMPOSE TEMPLATE - FULLSTACK (BACKEND + FRONTEND)
# ==============================================================================
# Template completo para proyectos con backend y frontend
#
# USO:
# 1. Copiar a tu proyecto
# 2. Reemplazar placeholders:
# - {{PROJECT}} -> nombre del proyecto (ej: gamilit)
# - {{BACKEND_PORT}} -> puerto backend (ej: 3000)
# - {{FRONTEND_PORT}} -> puerto frontend (ej: 3001)
# - {{API_DOMAIN}} -> dominio API (ej: api.gamilit.localhost)
# - {{WEB_DOMAIN}} -> dominio Web (ej: gamilit.localhost)
# ==============================================================================
version: "3.8"
# Anchors reutilizables
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
x-healthcheck-backend: &healthcheck-backend
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
x-healthcheck-frontend: &healthcheck-frontend
interval: 60s
timeout: 5s
retries: 3
start_period: 10s
services:
# ==========================================================================
# BACKEND
# ==========================================================================
{{PROJECT}}-api:
build:
context: ../apps/backend
dockerfile: Dockerfile
container_name: {{PROJECT}}-api
restart: unless-stopped
expose:
- "{{BACKEND_PORT}}"
environment:
- NODE_ENV=${NODE_ENV:-development}
- PORT={{BACKEND_PORT}}
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL:-}
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-1d}
- LOG_LEVEL=${LOG_LEVEL:-info}
- CORS_ORIGIN=${CORS_ORIGIN:-http://{{WEB_DOMAIN}}}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:{{BACKEND_PORT}}/health"]
<<: *healthcheck-backend
labels:
- "traefik.enable=true"
- "traefik.http.routers.{{PROJECT}}-api.rule=Host(`{{API_DOMAIN}}`)"
- "traefik.http.routers.{{PROJECT}}-api.entrypoints=web"
- "traefik.http.services.{{PROJECT}}-api.loadbalancer.server.port={{BACKEND_PORT}}"
networks:
- {{PROJECT}}_${ENV:-local}
- infra_shared
logging:
<<: *default-logging
# ==========================================================================
# FRONTEND
# ==========================================================================
{{PROJECT}}-web:
build:
context: ../apps/frontend
dockerfile: Dockerfile
args:
- REACT_APP_API_URL=http://{{API_DOMAIN}}
container_name: {{PROJECT}}-web
restart: unless-stopped
expose:
- "{{FRONTEND_PORT}}"
environment:
- NODE_ENV=${NODE_ENV:-development}
- REACT_APP_API_URL=${REACT_APP_API_URL:-http://{{API_DOMAIN}}}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:{{FRONTEND_PORT}}/"]
<<: *healthcheck-frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.{{PROJECT}}-web.rule=Host(`{{WEB_DOMAIN}}`)"
- "traefik.http.routers.{{PROJECT}}-web.entrypoints=web"
- "traefik.http.services.{{PROJECT}}-web.loadbalancer.server.port={{FRONTEND_PORT}}"
networks:
- {{PROJECT}}_${ENV:-local}
- infra_shared
depends_on:
- {{PROJECT}}-api
logging:
<<: *default-logging
# ==============================================================================
# NETWORKS
# ==============================================================================
networks:
{{PROJECT}}_${ENV:-local}:
external: true
infra_shared:
external: true