version: '3'

services:
  mysql:
    container_name: moneynote_mysql
    image: registry.cn-hangzhou.aliyuncs.com/moneynote/mysql5-arm:latest
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD:-78p7gkc1}
      - MYSQL_DATABASE=moneynote
    command: [
      '--character-set-server=utf8mb4',
      '--collation-server=utf8mb4_general_ci',
    ]
    volumes:
      - moneynote_mysql_data:/var/lib/mysql
    ports:
      - "43740:3306"

  phpmyadmin:
    container_name: moneynote_phpmyadmin
    image: registry.cn-hangzhou.aliyuncs.com/moneynote/phpmyadmin5:latest
    links:
      - mysql
    environment:
      PMA_ARBITRARY: 1
    restart: always
    ports:
      - "43741:80"

  api:
    container_name: moneynote_api
    links:
      - mysql
    image: registry.cn-hangzhou.aliyuncs.com/moneynote/moneynote-api:latest
    restart: always
    environment:
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_NAME=moneynote
      - DB_USER=root
      - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1}
      - invite_code=${invite_code:-111111}
    ports:
      - "43742:9092"

  pc:
    container_name: moneynote_pc
    links:
      - api
    image: registry.cn-hangzhou.aliyuncs.com/moneynote/moneynote-pc:latest
    restart: always
    environment:
      USER_API_HOST: http://api:9092
    ports:
      - "43743:80"

  h5:
    container_name: moneynote_h5
    links:
      - api
    image: registry.cn-hangzhou.aliyuncs.com/moneynote/moneynote-h5:latest
    restart: always
    environment:
      USER_API_HOST: http://api:9092
    ports:
      - "43744:80"

volumes:
  moneynote_mysql_data: