66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
# Production Docker Compose
|
|
# Usage: docker compose -f docker-compose.prod.yml up -d
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18-alpine
|
|
container_name: galaxis-po-db
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: ${DB_NAME}
|
|
volumes:
|
|
- /opt/galaxis-po/postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: always
|
|
networks:
|
|
- galaxy-net
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: galaxis-po-backend
|
|
env_file:
|
|
- .env.prod
|
|
environment:
|
|
DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
|
|
PYTHONPATH: /app
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
start_period: 10s
|
|
retries: 3
|
|
restart: always
|
|
networks:
|
|
- galaxy-net
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
container_name: galaxis-po-frontend
|
|
environment:
|
|
BACKEND_URL: http://backend:8000
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
restart: always
|
|
networks:
|
|
- galaxy-net
|
|
|
|
networks:
|
|
galaxy-net:
|
|
driver: bridge
|