-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.yml
44 lines (40 loc) · 1.65 KB
/
docker-compose.yml
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
version: '3.7'
services: # the different images that will be running as containers
db: # service name
image: postgres:11-alpine # image name of the postgres database. during build, this will be pulled from dockerhub and a container spun up from it
environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"
- POSTGRES_DB=${DB_NAME}
- PGPORT=${DB_PORT}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
ports:
- "${DB_PORT}:${DB_PORT}"
volumes:
- postgres_data:/var/lib/postgresql/data/
restart: "on-failure"
web: # service name
# platform defined to fix python packages installation issues on Apple Silicon
platform: linux/amd64
# allows one to attach the terminal of a running container for debugging
stdin_open: true
tty: true
build: . # build the image for the web service from the dockerfile in parent directory.
volumes:
- .:/app # map data and files from parent directory in host to plio directory in docker container
env_file: # file where env variables are stored. Used as best practice so as not to expose secret keys
- .env # name of the env file
image: plio-backend # name of the image
ports:
- "${APP_PORT}:${APP_PORT}"
restart: "on-failure"
depends_on: # cannot start if db service is not up and running
- db
redis: # service name
image: "redis:5" # image name of the redis database. during build, this will be pulled from dockerhub and a container spun up from it
ports:
- "6379:6379" # default redis port
depends_on:
- web # cannot start if web service is not up and running
volumes:
postgres_data: