version: '3.8'

services:
  mysql:
    image: mysql:8.0
    container_name: file_tag_manager_mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-FileTag@2026}
      MYSQL_DATABASE: file_manager
      MYSQL_USER: filemanager
      MYSQL_PASSWORD: ${MYSQL_USER_PASSWORD:-FileMgr@2026}
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - file_manager_network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  # 简单的 WebDAV 服务器用于测试
  webdav:
    image: bytemark/webdav
    container_name: file_tag_manager_webdav
    environment:
      AUTH_TYPE: Digest
      USERNAME: admin
      PASSWORD: FileTag@2026
    ports:
      - "8081:80"
    volumes:
      - webdav_data:/var/lib/dav
    networks:
      - file_manager_network
    restart: unless-stopped

volumes:
  mysql_data:
  webdav_data:

networks:
  file_manager_network:
    driver: bridge
