-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
41 lines (39 loc) · 1.43 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
#version of docker compose
version: "3"
services:
app:
build:
context: .
ports:
- "8000:8000"
#change anything will be updated here in docker image
volumes:
- ./app:/app
command: >
sh -c "python manage.py wait_for_db &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
#server us 0.0.0.0 which is avaible on all IP addresses that run on the
# docker
environment:
- DB_HOST=db # is the name of the service that runs the databse
- DB_NAME=app # should be the postgre DB which is the app from below
- DB_USER=postgres # this is the user name
- DB_PASS=supersecretpassowrd
# here we add the depends, which can be set in different way
# here we want the app to depend of the database service
depends_on:
- db
# here we want the databse service to start before the app
#service and the database service will be available via the network when we
# use the hostname DB
db:
image: postgres:10-alpine
# environment variables
environment:
- POSTGRES_DB=app
- POSTGRES_PASSWORD=supersecretpassowrd # this password will be overriden
# by encrypted environment variable by the deployment tool like jenkins
# or travis, also this should never include any real password because
# ifsees the code can access it
# this password will be used for run the server locally