138 lines
3.4 KiB
YAML
138 lines
3.4 KiB
YAML
# ===========================================
|
|
# MECANICAS DIESEL - Docker Compose
|
|
# ===========================================
|
|
# Uso: docker-compose up -d
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# -------------------------------------------
|
|
# PostgreSQL Database
|
|
# -------------------------------------------
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: mecanicas-diesel-db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: mecanicas_diesel
|
|
POSTGRES_USER: mecanicas_user
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-mecanicas_secret_2025}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./database/init:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mecanicas_user -d mecanicas_diesel"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mecanicas-network
|
|
|
|
# -------------------------------------------
|
|
# Redis (Cache y Colas)
|
|
# -------------------------------------------
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: mecanicas-diesel-redis
|
|
restart: unless-stopped
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mecanicas-network
|
|
|
|
# -------------------------------------------
|
|
# Backend API (NestJS)
|
|
# -------------------------------------------
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: mecanicas-diesel-api
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
- NODE_ENV=development
|
|
- DATABASE_URL=postgresql://mecanicas_user:${DB_PASSWORD:-mecanicas_secret_2025}@postgres:5432/mecanicas_diesel
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
ports:
|
|
- "3041:3041"
|
|
volumes:
|
|
- ./backend:/app
|
|
- /app/node_modules
|
|
networks:
|
|
- mecanicas-network
|
|
profiles:
|
|
- full
|
|
|
|
# -------------------------------------------
|
|
# Frontend (React + Vite)
|
|
# -------------------------------------------
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: mecanicas-diesel-web
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- VITE_API_URL=http://localhost:3041
|
|
ports:
|
|
- "5173:5173"
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
networks:
|
|
- mecanicas-network
|
|
profiles:
|
|
- full
|
|
|
|
# -------------------------------------------
|
|
# Adminer (DB Admin UI)
|
|
# -------------------------------------------
|
|
adminer:
|
|
image: adminer:latest
|
|
container_name: mecanicas-diesel-adminer
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- postgres
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
ADMINER_DEFAULT_SERVER: postgres
|
|
networks:
|
|
- mecanicas-network
|
|
profiles:
|
|
- tools
|
|
|
|
# -------------------------------------------
|
|
# Volumes
|
|
# -------------------------------------------
|
|
volumes:
|
|
postgres_data:
|
|
name: mecanicas-diesel-postgres
|
|
redis_data:
|
|
name: mecanicas-diesel-redis
|
|
|
|
# -------------------------------------------
|
|
# Networks
|
|
# -------------------------------------------
|
|
networks:
|
|
mecanicas-network:
|
|
name: mecanicas-diesel-network
|
|
driver: bridge
|