version: "3"

networks:
  covidapp-network:
    driver: bridge
  traefik_traefik-network:
    external: true

services: 
  covid_app:
    image: kr/covidapp
    restart: always
    networks:
      - covidapp-network
      - traefik_traefik-network
    build: .
    depends_on:
      - mysql
    labels:
      - traefik.http.routers.covidapp.rule=Host(`[[SITE_URL]]`)
      - traefik.http.routers.covidapp.tls=true
      - traefik.http.routers.covidapp.tls.certresolver=lets-encrypt
      - traefik.http.services.covidapp.loadbalancer.server.port=1337
      - traefik.port=1337
  
  mysql:
      image: mysql/mysql-server:latest
      container_name: mysql_covidapp
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: '[[MYSQL_ROOT_PASSWORD]]'
      command: mysqld --sql_mode="" --character-set-server=utf8mb4 --init-connect='SET NAMES UTF8;' --innodb-flush-log-at-trx-commit=0
      ports:
        - "[[HOST_PORT]]:3306"
      volumes:
        - /pwspool/software/covid19/mysql:/var/lib/mysql
        - ./schema:/docker-entrypoint-initdb.d/:ro
      networks:
        - covidapp-network

