Blame view

docker/docker-compose.yml 3.04 KB
c49d7824   Alexis Koralewski   create new folder...
1
2
3
4
5
version: "3.9"

services:
  db:
    # if we're using mysql >= 8, some of sql queries aren't valid anymore, like for creating and grant an user at the same time
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
6
7
    # This is fixed in pyros.py
    image: mysql:8.0.28
c49d7824   Alexis Koralewski   create new folder...
8
9
10
11
12
13
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    container_name: db_pyros
    environment:
      # note : as db is an image of mysql, this root password will be set on the first installation on the image, if the value is changed, it will not be updated in the database
      - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
d7a4c851   Etienne Pallier   Dockerfile avec U...
14
      - VNC_NO_PASSWORD=1
c49d7824   Alexis Koralewski   create new folder...
15
16
    volumes:
      - db:/var/lib/mysql/
c49d7824   Alexis Koralewski   create new folder...
17
18
    # create network to allow images to communicate with other images within the same network 
    networks: 
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
19
20
21
      pyros-network: 
        ipv4_address: 172.19.0.2

1db8bdb9   Alexis Koralewski   removing mysql tc...
22
23
24
25
26
    healthcheck:
      test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
      timeout: 10s
      interval: 5s
      retries: 20
c49d7824   Alexis Koralewski   create new folder...
27
28

  # service image of python, that let users to interact with python scripts such as pyros.
49805654   Alexis Koralewski   renaming pyros co...
29
  pyros:
950ade71   Alexis Koralewski   fixing comment on...
30
    # path to the Dockerfile of this image
426c1b7e   Alexis Koralewski   updating how envi...
31
32
    env_file: 
      - variables.env
c49d7824   Alexis Koralewski   create new folder...
33
    environment:
23d1f666   Alexis Koralewski   Set specific envi...
34
35
      # environment variables only for Docker
      - WITH_DOCKER=y
e5d50896   Alexis Koralewski   Disabling common ...
36
37
38
      # disabling other env variables because they will override those from the env_file
      # - MYSQL_ROOT_LOGIN=root
      # - MYSQL_TCP_PORT=3306
23d1f666   Alexis Koralewski   Set specific envi...
39
      # environment variables available for both Docker usage and non Docker usage
e5d50896   Alexis Koralewski   Disabling common ...
40
41
42
      # - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
      # - "MYSQL_PYROS_LOGIN=${MYSQL_PYROS_LOGIN:-pyros}"
      # - "MYSQL_PYROS_PWD=${MYSQL_PYROS_PWD:-DjangoPyros}"
48bacc35   Alexis Koralewski   add mysql port as...
43
      #- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}"
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
44
45
46
47
    build: 
      args:
        uid: ${CURRENT_UID}
      context: ..
d7a4c851   Etienne Pallier   Dockerfile avec U...
48
        #filename: Dockerfile
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
49
    container_name: pyros
90bc3587   Alexis Koralewski   Add fix hostname ...
50
    hostname: ${COMPUTER_HOSTNAME}
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
51
52
53
54
    # tty is the -t option in docker exec 
    tty: true
    # stdin_open is the -i option in docker exec
    stdin_open: true
c49d7824   Alexis Koralewski   create new folder...
55
    volumes:
9cddcbc7   Alexis Koralewski   fixing path for p...
56
      - ..:/home/pyros_user/app
c49d7824   Alexis Koralewski   create new folder...
57
58
    # tells which port of local machine can communicate with the docker image (host:container), host is your local machine
    ports:
3e125e8f   Alexis Koralewski   Add webport perso...
59
      - "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}"
d7a4c851   Etienne Pallier   Dockerfile avec U...
60
      - 5900:5900
c49d7824   Alexis Koralewski   create new folder...
61
62
63
64
65
    # starting db service before install service 
    depends_on:
      - db
    # create network to allow images to communicate with other images within the same network 
    networks: 
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
66
67
      pyros-network:
        ipv4_address: 172.19.0.3
48bacc35   Alexis Koralewski   add mysql port as...
68
        #ipv4_address: "${IP_PYROS_USER}"
1db8bdb9   Alexis Koralewski   removing mysql tc...
69
    restart: always
864ec466   Alexis Koralewski   Renaming common t...
70
71
72
73
74
75
76
77
78
79
80
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: pma
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    restart: always
    networks: 
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
81
82
      pyros-network:
        ipv4_address: 172.19.0.4
864ec466   Alexis Koralewski   Renaming common t...
83
84
    ports:
      - 8081:80
1db8bdb9   Alexis Koralewski   removing mysql tc...
85

c49d7824   Alexis Koralewski   create new folder...
86
87
88
89
# declaring volumes
volumes:
  db:
    driver: local
c49d7824   Alexis Koralewski   create new folder...
90
91
92
# declaring networks
networks: 
  pyros-network:
c49d7824   Alexis Koralewski   create new folder...
93
    #bridge is the default network driver
d7a4c851   Etienne Pallier   Dockerfile avec U...
94
    driver: bridge
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
95
96
97
98
    ipam:
      config:
        - subnet: 172.19.0.0/16
          gateway: 172.19.0.1