version: '3.8' # =========================================== # 日志轮转配置(所有服务共享) # =========================================== x-logging: &default-logging driver: json-file options: max-size: "50m" max-file: "3" services: postgres: image: postgres:16 container_name: xiaoxia-postgres restart: always environment: POSTGRES_DB: xiaoxia_saas POSTGRES_USER: xiaoxia POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme_in_production} ports: - "127.0.0.1:5432:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - xiaoxia-net logging: *default-logging healthcheck: test: ["CMD-SHELL", "pg_isready -U xiaoxia"] interval: 30s timeout: 5s retries: 5 redis: image: redis:7 container_name: xiaoxia-redis restart: always ports: - "127.0.0.1:6379:6379" volumes: - redis_data:/data networks: - xiaoxia-net logging: *default-logging healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 3s retries: 5 volumes: postgres_data: redis_data: networks: xiaoxia-net: name: xiaoxia-net-staging