name: lotterlaravel-e2e # e2e 测试专用:只起后端依赖(Postgres + Redis)。 # Laravel 应用本身由 `e2e/scripts/run.sh` 在宿主机上以 `php artisan serve` 拉起, # 这样保留与生产一致的 PHP-FPM / OPCache / .env 加载路径,也避免在容器里 # 重新装一遍 vendor。容器只在需要数据库与缓存时使用。 # # 使用方法(在仓库根): # docker compose -f e2e/docker-compose.yml up -d # ./e2e/scripts/run.sh # docker compose -f e2e/docker-compose.yml down -v # # macOS 用户:OrbStack / Colima / Docker Desktop 任一即可。 # Apple Silicon 警告:postgis/postgis 镜像仅支持 amd64;用 postgres:16-alpine 即可。 services: postgres: image: postgres:16-alpine container_name: lotterlaravel-e2e-pg restart: unless-stopped environment: POSTGRES_USER: lottery POSTGRES_PASSWORD: lottery POSTGRES_DB: lottery_e2e ports: - "15432:5432" volumes: - lotterlaravel-e2e-pg:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U lottery -d lottery_e2e"] interval: 2s timeout: 3s retries: 30 redis: image: redis:7-alpine container_name: lotterlaravel-e2e-redis restart: unless-stopped ports: - "16379:6379" command: - redis-server - --save - "" - --appendonly - "no" # e2e 跑完即清,不做持久化(启动更快,状态可重现) healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 2s timeout: 3s retries: 30 volumes: lotterlaravel-e2e-pg: