docker-compose.yml 1.72 KB
Newer Older
1
2
3
4
5
version: '3.8'

services:
  mariadb:
    image: mariadb:11.3
6
    restart: always
7
8
9
10
11
12
13
    env_file:
      - ./.env
    volumes:
      - mariadb_data:/var/lib/mysql
    ports:
      - 3306:3306
    networks:
14
      - network  # Adding the network communication between containers
15
16
    environment:
      - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
17
18
19
      - MOODLE_DATABASE_USER=${MOODLE_DATABASE_USER}
      - MOODLE_DATABASE_PASSWORD=${MOODLE_DATABASE_PASSWORD}

20
21
22
23

  moodle:
    env_file:
      - ./.env
24
    restart: always
25
26
    build:  # Building own Moodle container from Dockerfile.
      context: .  # The context of the build (where is Dockerfile)
27
28
29
30
31
32
      dockerfile: Dockerfile
      args:
        - MOODLE_BASE_DIR=${MOODLE_BASE_DIR}
        - MOODLE_BASE_DIR_DATA=${MOODLE_BASE_DIR_DATA}
        - MOODLE_DATABASE_TYPE=mariadb
        - MOODLE_DATABASE_HOST=${MOODLE_DATABASE_HOST}
33
34
35
        - MOODLE_DATABASE_NAME=${MOODLE_DATABASE_NAME}
        - MOODLE_DATABASE_USER=${MOODLE_DATABASE_USER}
        - MOODLE_DATABASE_PASSWORD=${MOODLE_DATABASE_PASSWORD}
36
    ports:
37
38
39
      - 80:80
      - 443:443
      - 5000:5000
40
41
42
    dns:
      - 8.8.8.8
      - 8.8.4.4
43
    depends_on: # Dependency from MariaDB service
44
45
      - mariadb
    volumes:
46
47
48
      - ${PWD}/asystgrade:${MOODLE_BASE_DIR}/local/asystgrade  # Sync the plugin folder with the container
      - moodle_data:${MOODLE_BASE_DIR}  # Volume for Moodle
      - moodledata:${MOODLE_BASE_DIR_DATA}  # Volume for Moodle data
49
    networks:
50
51
52
      - network  # Adding the network communication between containers

volumes: # Defining local volumes
53
  moodledata:
54
    driver: local
55
56
57
58
  mariadb_data:
    driver: local
  moodle_data:
    driver: local
59
  asystgrade:
60
    driver: local
61
62

networks:
63
  network:  # Creating a network