Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
53 lines (52 loc) · 1.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
53 lines (52 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# every docker compose file should start with what version is being used
# yml are similar to json files, but instead of declaring what type each data value is, yml reads each bit of data as a string and then sets it to a value
# yml also doesnt use commas, instead using new lines, and doesnt use brackets but indentation instead
# yml is slower than json which is why json is used for client / server due to its speed - whereas yml is used for configuration
version: "3.8"
# telling docker about different containers for the program
services:
#frontend:
# add when frontend is done
db:
# pull image
image: mysql:latest
# give name
container_name: db
# always restart if it fails
restart: always
# map to these ports
environment:
# get this from .env
MYSQL_ROOT_PASSWORD: "${PASSWORD}"
# for some reason this line wants to name and create the database
MYSQL_DATABASE: db
ports:
- 3307:3306
expose:
- 3307
volumes:
# tells docker to look after this for us
- db:/var/lib/mysql
# initialises the sql table
- ./db/init:/docker-entrypoint-initdb.d
networks:
- backend
api:
container_name: api
# can give properties here
build: ./scraper_Scripts
# define port mapping
ports:
- 5001:5001
# depend on the db to be up
depends_on:
- db
# assign it to the backend bridge to allow communication
networks:
- backend
volumes:
db:
# create a user defined bridge to allow for routing to name instead of ip in multi container apps
networks:
backend:
driver: bridge