docker-compose.yml 2.21 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
    build:  # Building own Moodle container from Dockerfile.
26
      context: ./moodle  # 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
        - MOODLE_PHPUNIT_DATAROOT=${MOODLE_PHPUNIT_DATAROOT}
37
    ports:
38
39
      - 80:80
      - 443:443
40
      - 9003:9003
41
42
43
    dns:
      - 8.8.8.8
      - 8.8.4.4
44
    depends_on: # Dependency from MariaDB service
45
46
      - mariadb
    volumes:
47
48
49
      - ${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
50
      - moodle_phpunit_data:${MOODLE_PHPUNIT_DATAROOT}
51
    networks:
52
53
      - network  # Adding the network communication between containers

54
55
  flask:
    build:
56
      context: ./flask  # The context of the Flask build (where is Dockerfile)
57
58
59
60
61
62
63
64
65
66
67
68
69
      dockerfile: Dockerfile
    env_file:
      - ./.env
    restart: always
    ports:
      - 5000:5000
    volumes:
      - ./flask:/app
    depends_on:
      - mariadb
    networks:
      - network

70
volumes: # Defining local volumes
71
  moodledata:
72
    driver: local
73
74
75
76
  mariadb_data:
    driver: local
  moodle_data:
    driver: local
77
  asystgrade:
78
    driver: local
79
80
  flask:
    driver: local
81
82
  moodle_phpunit_data:
    driver: local
83
84

networks:
85
  network:  # Creating a network