services:
  caddy:
    image: caddy:alpine
    restart: always
    volumes:
      - ./html:/var/www/html
      - ./caddy/etc/Caddyfile:/etc/caddy/Caddyfile
    ports:
      - "80:80"
    expose:
      - 80

  moodle_db:
    image: mariadb:10
    container_name: moodle_db
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 1
      MYSQL_DATABASE: moodle
      MYSQL_USER: moodle
      MYSQL_PASSWORD: yXoPah6yZ8o8Xwpa57Lb9w
    volumes:
      - ./moodle/database:/var/lib/mysql
  moodle:
    image: moodlehq/moodleapp:latest
    ports:
      - "8000:80"
    expose:
      - 443
    environment:
      MOODLE_DOMAIN: moodle.localhost
      MOODLE_DB_HOST: moodle_db
      MYSQL_PORT_3306_TCP: 3306
      MOODLE_DB_NAME: moodle
      MOODLE_DB_USER: moodle
      MOODLE_DB_PASSWORD: yXoPah6yZ8o8Xwpa57Lb9w
    volumes:
      - ./moodle/www:/var/www/html