2026-02-03 12:27:34 +09:00
|
|
|
# Production Docker Compose
|
2026-02-07 23:09:22 +09:00
|
|
|
# Usage: docker compose -f docker-compose.prod.yml up -d
|
2026-02-13 23:47:46 +09:00
|
|
|
#
|
|
|
|
|
# DB data is stored in a named volume (galaxis-po_postgres_data).
|
|
|
|
|
# This survives container recreation and avoids path resolution issues
|
|
|
|
|
# when deploying via CI runners with shared Docker sockets.
|
|
|
|
|
# To back up: docker exec galaxis-po-db pg_dump -U $DB_USER $DB_NAME > backup.sql
|
|
|
|
|
# Volume is only removed with: docker volume rm galaxis-po_postgres_data
|
2026-02-03 12:27:34 +09:00
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
postgres:
|
2026-02-07 11:12:16 +09:00
|
|
|
image: postgres:18-alpine
|
2026-02-05 23:24:53 +09:00
|
|
|
container_name: galaxis-po-db
|
2026-02-03 12:27:34 +09:00
|
|
|
environment:
|
|
|
|
|
POSTGRES_USER: ${DB_USER}
|
|
|
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
|
|
|
POSTGRES_DB: ${DB_NAME}
|
|
|
|
|
volumes:
|
2026-02-13 23:47:46 +09:00
|
|
|
- postgres_data:/var/lib/postgresql
|
2026-02-03 12:27:34 +09:00
|
|
|
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
|
2026-02-05 23:24:53 +09:00
|
|
|
container_name: galaxis-po-backend
|
2026-02-03 12:27:34 +09:00
|
|
|
env_file:
|
|
|
|
|
- .env.prod
|
|
|
|
|
environment:
|
|
|
|
|
DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
|
|
|
|
|
PYTHONPATH: /app
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
2026-02-07 23:09:22 +09:00
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
start_period: 10s
|
|
|
|
|
retries: 3
|
2026-02-03 12:27:34 +09:00
|
|
|
restart: always
|
|
|
|
|
networks:
|
|
|
|
|
- galaxy-net
|
|
|
|
|
|
|
|
|
|
frontend:
|
|
|
|
|
build:
|
|
|
|
|
context: ./frontend
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
target: production
|
2026-02-05 23:24:53 +09:00
|
|
|
container_name: galaxis-po-frontend
|
2026-02-03 12:27:34 +09:00
|
|
|
environment:
|
2026-02-07 23:09:22 +09:00
|
|
|
BACKEND_URL: http://backend:8000
|
|
|
|
|
ports:
|
2026-02-08 00:06:21 +09:00
|
|
|
- "3000:3000"
|
2026-02-03 12:27:34 +09:00
|
|
|
depends_on:
|
|
|
|
|
backend:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
restart: always
|
|
|
|
|
networks:
|
|
|
|
|
- galaxy-net
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
galaxy-net:
|
|
|
|
|
driver: bridge
|
2026-02-13 23:47:46 +09:00
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
postgres_data:
|
|
|
|
|
driver: local
|