docker-compose.yml 2.04 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
    ports:
37
38
      - 80:80
      - 443:443
39
40
41
    dns:
      - 8.8.8.8
      - 8.8.4.4
42
    depends_on: # Dependency from MariaDB service
43
44
      - mariadb
    volumes:
45
46
47
      - ${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
48
    networks:
49
50
      - network  # Adding the network communication between containers

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

67
volumes: # Defining local volumes
68
  moodledata:
69
    driver: local
70
71
72
73
  mariadb_data:
    driver: local
  moodle_data:
    driver: local
74
  asystgrade:
75
    driver: local
76
77
  flask:
    driver: local
78
79

networks:
80
  network:  # Creating a network