- Agregar ARG en client/Dockerfile para NEXT_PUBLIC_API_URL - Pasar build args en docker-compose.yml - Asegurar que Next.js reciba la URL correcta del servidor - Permitir acceso desde 192.168.1.131
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
services:
|
|
# --- FRONTEND (Next.js) ---
|
|
client:
|
|
container_name: resistencia-client
|
|
build:
|
|
context: .
|
|
dockerfile: client/Dockerfile
|
|
args:
|
|
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:4000}
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- ./client:/app/client
|
|
- ./shared:/app/shared
|
|
- /app/client/node_modules
|
|
environment:
|
|
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:4000}
|
|
depends_on:
|
|
- server
|
|
networks:
|
|
- resistencia-net
|
|
|
|
# --- BACKEND (Node/Express + Socket.io) ---
|
|
server:
|
|
container_name: resistencia-server
|
|
build:
|
|
context: .
|
|
dockerfile: server/Dockerfile
|
|
ports:
|
|
- "4000:4000"
|
|
volumes:
|
|
- ./server:/app/server
|
|
- ./shared:/app/shared
|
|
- /app/server/node_modules
|
|
environment:
|
|
- PORT=4000
|
|
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:password@db:5432/resistencia}
|
|
- CORS_ORIGIN=${CORS_ORIGIN:-http://localhost:3000}
|
|
depends_on:
|
|
- db
|
|
networks:
|
|
- resistencia-net
|
|
|
|
# --- BASE DE DATOS (PostgreSQL) ---
|
|
db:
|
|
container_name: resistencia-db
|
|
image: postgres:15-alpine
|
|
restart: always
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: resistencia
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- resistencia-net
|
|
|
|
networks:
|
|
resistencia-net:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres_data:
|