galaxis-po/docker-compose.prod.yml
zephyrdark 39d2226d95
Some checks failed
Deploy to Production / deploy (push) Failing after 46s
feat: production deployment setup with Gitea Actions CI/CD
- Remove nginx from docker-compose.prod.yml (NPM handles reverse proxy)
- Add Next.js rewrites to proxy /api/* to backend (backend fully hidden)
- Bind frontend to 127.0.0.1:3000 only (NPM proxies externally)
- Replace hardcoded localhost:8000 in history page with api client
- Make CORS origins configurable via environment variable
- Restrict CORS methods to GET/POST/PUT/DELETE
- Add Gitea Actions deploy workflow with secrets-based env management
- Add security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy)
- Add BACKEND_URL build arg to frontend Dockerfile for standalone builds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 23:09:22 +09:00

70 lines
1.6 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:
- 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:
- "127.0.0.1:3000:3000"
depends_on:
backend:
condition: service_healthy
restart: always
networks:
- galaxy-net
volumes:
postgres_data:
driver: local
networks:
galaxy-net:
driver: bridge