services:
  chatnio:
    image: programzmh/chatnio:3.11.2
    container_name: ${CONTAINER_NAME}
    restart: always
    ports:
      - "${PANEL_APP_PORT_HTTP}:8094"
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment:
      MYSQL_HOST: mysql
      MYSQL_USER: ${PANEL_DB_USER}
      MYSQL_PASSWORD: ${PANEL_DB_USER_PASSWORD}
      MYSQL_DB: ${PANEL_DB_NAME}
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: ${PANEL_REDIS_ROOT_PASSWORD}
      REDIS_DB: ${REDIS_DB}
      SERVE_STATIC: "${SERVE_STATIC}"
    volumes:
      - ./data/config:/config
      - ./data/logs:/logs
      - ./data/storage:/storage
    networks:
      - 1panel-network
    labels:
      createdBy: "Apps"

  mysql:
    image: mysql:latest
    container_name: ${CONTAINER_NAME}_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${PANEL_DB_ROOT_PASSWORD}
      MYSQL_DATABASE: ${PANEL_DB_NAME}
      MYSQL_USER: ${PANEL_DB_USER}
      MYSQL_PASSWORD: ${PANEL_DB_USER_PASSWORD}
      TZ: Asia/Shanghai
    expose:
      - "3306"
    volumes:
      - ./data/mysql:/var/lib/mysql
    networks:
      - 1panel-network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      timeout: 5s
      retries: 5
    labels:
      createdBy: "Apps"

  redis:
    image: redis:latest
    container_name: ${CONTAINER_NAME}_redis
    restart: always
    command: redis-server --requirepass ${PANEL_REDIS_ROOT_PASSWORD}
    expose:
      - "6379"
    volumes:
      - ./data/redis:/data
    networks:
      - 1panel-network
    healthcheck:
      test: ["CMD", "redis-cli", "-a", "${PANEL_REDIS_ROOT_PASSWORD}", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    labels:
      createdBy: "Apps"

networks:
  1panel-network:
    external: true