version: "3"

services:
  flarum:
    image: mondedie/flarum:stable
    container_name: flarum
    env_file:
      - .env
    labels:
      - traefik.enable=true
      - traefik.http.routers.flarum.rule=Host(`${URL_FLARUM}`)
      - traefik.http.routers.flarum.entrypoints=websecure
      - traefik.http.routers.flarum.tls=true
      - traefik.http.routers.flarum.tls.certresolver=lets-encrypt
      - traefik.http.routers.flarum.service=flarum-srv
      - traefik.http.services.flarum-srv.loadbalancer.server.port=8888
      - traefik.docker.network=${NETWORK_TRAEFIK}
    volumes:
      - dataflarum:/flarum/app
#      - ./mnt/docker/flarum/assets:/flarum/app/public/assets
#      - ./mnt/docker/flarum/extensions:/flarum/app/extensions
#      - ./mnt/docker/flarum/storage/logs:/flarum/app/storage/logs
      - ./mnt/docker/flarum/nginx:/etc/nginx/flarum
    networks:
      - traefik-proxy
      - flarum-network
    depends_on:
      - mariadb

  mariadb:
    image: mariadb:10.5
    container_name: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=superadmin
      - MYSQL_DATABASE=${DB_NAME}
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASS}
    volumes:
      - mysqlflarum:/var/lib/mysql 
    networks:
      - flarum-network

networks:
  traefik-proxy:
    external:
      name: ${NETWORK_TRAEFIK}
  flarum-network:
    internal: true

volumes:
 mysqlflarum:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_DB_FLARUM}
      o: bind

 dataflarum:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_DATA_FLARUM}
      o: bind

 nginxflarum:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_NGINX_FLARUM}
      o: bind