# AWOOOI 整合測試用 Docker Compose # =================================== # 用途: CI 環境中提供完全隔離的 PostgreSQL + Redis # 不用於生產環境 # # 啟動: docker compose -f docker-compose.test.yml up -d # 停止: docker compose -f docker-compose.test.yml down -v # # 2026-04-10 Claude Sonnet 4.6 Asia/Taipei services: postgres-test: image: pgvector/pgvector:pg16 environment: POSTGRES_DB: awoooi_test POSTGRES_USER: awoooi POSTGRES_PASSWORD: awoooi_test_2026 ports: - "15432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U awoooi -d awoooi_test"] interval: 5s timeout: 3s retries: 10 tmpfs: - /var/lib/postgresql/data # 記憶體內 — 快 + 隔離 redis-test: image: redis:7-alpine ports: - "16380:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 # 2026-04-10 Claude Sonnet 4.6 Asia/Taipei: 整合測試 runner # 在 compose 網路內跑 pytest,hostname=postgres-test 直連,不依賴 host venv # Schema 由 CD workflow 用 compose exec psql 初始化(避免 DinD volume 路徑問題) pytest-runner: image: python:3.11-slim working_dir: /workspace volumes: - .:/workspace environment: TEST_DATABASE_URL: "postgresql+asyncpg://awoooi:awoooi_test_2026@postgres-test:5432/awoooi_test?ssl=disable" depends_on: postgres-test: condition: service_healthy redis-test: condition: service_healthy command: > sh -c "pip install -q uv && uv pip install -q --system -e '.[dev]' && pytest tests/integration/test_b5_core_flows.py -v --tb=short" profiles: - test # 只在明確指定 --profile test 時才啟動