networks:
  score-admin:
    driver: bridge
    enable_ipv6: false

services:
  mysql:
    image: mysql:8.4.0
    container_name: score_mysql
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    restart: always
    ports:
      - '1236:3306'
    environment:
      MYSQL_DATABASE: 'score'
      MYSQL_ROOT_PASSWORD: 'UeoGr9qOhBWpQV'
    volumes:
      - /docker/score/mysql/log:/var/log
      - /docker/score/mysql/data:/var/lib/mysql
      - /docker/score/mysql/conf.d:/etc/mysql/conf.d
      - /etc/localtime:/etc/localtime:ro
    networks:
      score-admin:
        aliases:
          - mysqlserver
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 1000M
        reservations:
          cpus: '0.05'
          memory: 200M
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  redis:
    image: redis:7.0.8-alpine
    container_name: score_redis
    restart: always
#    ports:
#      - '6379:6379'
    volumes:
      - /docker/score/redis:/data
      - /etc/localtime:/etc/localtime:ro
    networks:
      score-admin:
        aliases:
          - redisserver
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 500M
        reservations:
          cpus: '0.05'
          memory: 200M
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  zlmediakit:
    image: zlmediakit/zlmediakit:master
    container_name: zlmediakit
    restart: always
    ports:
      - "1935:1935"
      - "8080:80"
      - "8443:443"
      - "8554:554"
      - "10000:10000"
      - "10000:10000/udp"
      - "8000:8000/udp"
      - "9000:9000/udp"
    volumes:
      - /docker/zlmediakit/media/bin/log:/opt/media/bin/log
      - /docker/zlmediakit/media/conf:/opt/media/conf
    tty: true
    stdin_open: true
    networks:
      score-admin:
        aliases:
          - zlmediakit
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  core-rpc:
    image: core_rpc:1.0.0
    container_name: score_core-rpc
    restart: always
    networks:
      score-admin:
        aliases:
          - core-rpc
    volumes:
      - /docker/score/rpc:/app/etc
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - mysql
      - redis
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 500M
        reservations:
          cpus: '0.05'
          memory: 200M
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  core-api:
    image: core_api:1.0.0
    container_name: score_core-api
    restart: always
    ports:
      - '9100:9100'
    networks:
      score-admin:
        aliases:
          - core-api
    volumes:
      - /docker/score/api:/app/etc
      - /docker/score/locale/core-api:/app/locale
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - mysql
      - redis
      - core-rpc
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 500M
        reservations:
          cpus: '0.05'
          memory: 200M
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  score-api:
    image: score_api:1.0.8
    container_name: score-api
    restart: always
    ports:
      - '8100:8100'
    networks:
      score-admin:
        aliases:
          - score-api
    volumes:
      - /docker/score/api:/app/etc
      - /docker/score/data/:/app/data
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - mysql
      - redis
      - core-rpc
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 500M
        reservations:
          cpus: '0.05'
          memory: 200M
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  learningsmart-api:
    image: learningsmart_api:1.0.1
    container_name: learningsmart_api
    restart: always
    ports:
      - '8200:8200'
    networks:
      score-admin:
        aliases:
          - core-api
    volumes:
      - /docker/learningsmart/api:/app/etc
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - mysql
      - redis
      - core-rpc
      - zlmediakit
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"