-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.local.yml
More file actions
77 lines (73 loc) · 2.08 KB
/
docker-compose.local.yml
File metadata and controls
77 lines (73 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
services:
# --- 1. BASE DE DATOS (PostgreSQL 15) ---
postgres-db:
image: postgres:15-alpine
container_name: gaply-postgres-local
ports:
- "5432:5432"
volumes:
- postgres-local-data:/var/lib/postgresql/data/pgdata
# Scripts de inicialización (se ejecutan en orden alfabético al crear el volumen)
- ./db/init:/docker-entrypoint-initdb.d
# Datos CSV montados para que el script de carga los encuentre
- "./Gaply - Reduciendo la Brecha Laboral DATASET/Datos:/csv-data:ro"
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
networks:
- gaply-local-net
restart: unless-stopped
# --- 2. BACKEND (FastAPI + hot-reload) ---
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: gaply-backend-local
ports:
- "8000:8000"
volumes:
# Hot-reload: monta código local
- ./backend/app:/app
# Montar .env para python-dotenv
- ./.env:/app/.env:ro
env_file:
- .env
environment:
- DATABASE_URL=postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-db:5432/${POSTGRES_DB}
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
networks:
- gaply-local-net
depends_on:
postgres-db:
condition: service_healthy
restart: unless-stopped
# --- 3. FRONTEND (Next.js) ---
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: gaply-frontend-local
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_URL=http://backend:8000
networks:
- gaply-local-net
depends_on:
- backend
restart: unless-stopped
networks:
gaply-local-net:
driver: bridge
name: gaply-local-net
volumes:
postgres-local-data: