services: app: build: ./app restart: unless-stopped environment: - TZ=Asia/Shanghai - REDIS_ADDR=redis:6379 - DB_HOST=postgres - DB_PORT=5432 - DB_USER=postgres - DB_PASSWORD=postgres - DB_NAME=doudizhu depends_on: flyway: condition: service_completed_successfully redis: condition: service_healthy nginx: image: nginx:alpine ports: - "80:80" volumes: - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./nginx/html:/usr/share/nginx/html:ro depends_on: - app restart: unless-stopped environment: - TZ=Asia/Shanghai redis: image: redis:7-alpine restart: unless-stopped command: > redis-server --maxmemory 128mb --maxmemory-policy volatile-ttl --save "" --appendonly no healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 environment: - TZ=Asia/Shanghai postgres: image: postgres:16-alpine restart: unless-stopped environment: - TZ=Asia/Shanghai - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=doudizhu volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d doudizhu"] interval: 5s timeout: 3s retries: 5 flyway: image: flyway/flyway:10 depends_on: postgres: condition: service_healthy volumes: - ./flyway/migrations:/flyway/sql:ro command: > -url=jdbc:postgresql://postgres:5432/doudizhu -user=postgres -password=postgres -connectRetries=10 migrate volumes: postgres_data: