name: zhibaotong-infrastructure

services:
  mysql:
    image: mysql:8.0
    container_name: zhibaotong-mysql
    restart: unless-stopped
    environment:
      TZ: Asia/Shanghai
      MYSQL_ROOT_PASSWORD: mysql147258
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_0900_ai_ci
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    healthcheck:
      test:
        - CMD-SHELL
        - mysqladmin ping -h 127.0.0.1 -uroot -p"$$MYSQL_ROOT_PASSWORD" --silent
      interval: 10s
      timeout: 5s
      retries: 10
      start_period: 30s

  redis:
    image: redis:7-alpine
    container_name: zhibaotong-redis
    restart: unless-stopped
    environment:
      TZ: Asia/Shanghai
      REDIS_PASSWORD: redis147258
    command:
      - redis-server
      - --appendonly
      - "yes"
      - --requirepass
      - redis147258
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data
    healthcheck:
      test:
        - CMD-SHELL
        - redis-cli -a "$$REDIS_PASSWORD" --no-auth-warning ping
      interval: 10s
      timeout: 5s
      retries: 10
      start_period: 5s

volumes:
  mysql-data:
  redis-data:
