services:
  mysql:
    image: registry.cn-hangzhou.aliyuncs.com/pull-image/mysql:8.0
    container_name: zzyl-mysql
    restart: unless-stopped
    environment:
      TZ: ${TZ}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_USER: ${MYSQL_APP_USER}
      MYSQL_PASSWORD: ${MYSQL_APP_PASSWORD}
    ports:
      - "${MYSQL_PORT}:3306"
    command:
      - --default-authentication-plugin=mysql_native_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_general_ci
    volumes:
      - mysql_data:/var/lib/mysql

  redis:
    image: registry.cn-hangzhou.aliyuncs.com/pull-image/redis:7-alpine
    container_name: zzyl-redis
    restart: unless-stopped
    environment:
      TZ: ${TZ}
    ports:
      - "${REDIS_PORT}:6379"
    command: >
      sh -c "redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}"
    volumes:
      - redis_data:/data

  zzyl-admin:
    image: ${ZZYL_ADMIN_IMAGE}
    container_name: zzyl-admin
    restart: unless-stopped
    env_file:
      - .env
    depends_on:
      - mysql
      - redis
    environment:
      TZ: ${TZ}
      SPRING_PROFILES_ACTIVE: prod
    ports:
      - "${APP_PORT}:9000"
    volumes:
      - ${APP_LOG_DIR}:/home/ruoyi/logs
      - ${APP_PROFILE_DIR}:${APP_PROFILE_DIR}

  zzyl-ui:
    image: ${ZZYL_UI_IMAGE}
    container_name: zzyl-ui
    restart: unless-stopped
    depends_on:
      - zzyl-admin
    ports:
      - "${UI_PORT}:80"

volumes:
  mysql_data:
  redis_data:
