version: "3.9"

services:
  mysql:
    image: "mysql:8"
    container_name: mayfly-go-mysql
    environment:
      MYSQL_ROOT_PASSWORD: 111049
      MYSQL_DATABASE: mayfly-go
      TZ: Asia/Shanghai
    volumes:
      - ./server/docs/docker-compose/mysql/data/mydir:/mydir
      - ./server/docs/docker-compose/mysql/data/datadir:/var/lib/mysql
    restart: always

  server:
    image: mayfly-go:v1.3.1
    build:
      context: .
      dockerfile: Dockerfile
    container_name: mayfly-go-server
    ports:
      - "8888:8888"
    environment:
      TZ: Asia/Shanghai
      WAIT_HOSTS: mysql:3306
    volumes:
      - ./server/config.yml.example:/mayfly/config.yml
    depends_on:
      - mysql
    restart: always
