Commit c49d78249e69f2ed5d416a387101fabe6b10418d

Authored by Alexis Koralewski
1 parent 3999466c
Exists in dev

create new folder 'docker' which contains docker-compose.yml and .env-sample

Showing 2 changed files with 62 additions and 0 deletions   Show diff stats
docker/.env-sample 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +# any value as password without any space
  2 +MYSQL_ROOT_PASSWORD=groot
  3 +# accepted values : y or yes
  4 +WITH_DOCKER=yes
0 \ No newline at end of file 5 \ No newline at end of file
docker/docker-compose.yml 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  1 +version: "3.9"
  2 +
  3 +services:
  4 + db:
  5 + # 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
  6 + image: mysql:5.7.22
  7 + command: --default-authentication-plugin=mysql_native_password
  8 + restart: always
  9 + container_name: db_pyros
  10 + environment:
  11 + # 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
  12 + - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
  13 + volumes:
  14 + - db:/var/lib/mysql/
  15 + - db:/var/lib/mysql-files
  16 + - ./mysql/:/etc/mysql/
  17 + # create network to allow images to communicate with other images within the same network
  18 + networks:
  19 + pyros-network:
  20 + aliases:
  21 + - mysql
  22 +
  23 + # service image of python, that let users to interact with python scripts such as pyros.
  24 + install:
  25 + # build from the Dockerfile within the folder where docker-compose is saved
  26 + build: ..
  27 + container_name: pyros
  28 + # tty is the -t option in docker exec
  29 + tty: true
  30 + # stdin_open is the -i option in docker exec
  31 + stdin_open: true
  32 + environment:
  33 + - "WITH_DOCKER=${WITH_DOCKER:-y}"
  34 + - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
  35 + volumes:
  36 + - .:/home/python/app
  37 + # tells which port of local machine can communicate with the docker image (host:container), host is your local machine
  38 + ports:
  39 + - "8000:8000"
  40 + # starting db service before install service
  41 + depends_on:
  42 + - db
  43 + # create network to allow images to communicate with other images within the same network
  44 + networks:
  45 + - pyros-network
  46 +
  47 +# declaring volumes
  48 +volumes:
  49 + db:
  50 + driver: local
  51 +
  52 +# declaring networks
  53 +networks:
  54 + pyros-network:
  55 +
  56 + #bridge is the default network driver
  57 + driver: bridge
  58 +
0 \ No newline at end of file 59 \ No newline at end of file