-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
44 lines (42 loc) · 1.56 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'
services:
db:
image: postgres
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
migration:
build: .
# command: python3 manage.py migrate
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; python3 manage.py migrate'
volumes:
- .:/usr/src/app
depends_on:
- db
web:
build: .
# command: python3 manage.py runserver 0.0.0.0:8000
# container_name: webapp-dpdth
image: webapp-dpdth
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; python3 manage.py runserver 0.0.0.0:8000'
volumes:
- .:/usr/src/app
ports:
- "8000:8000"
depends_on:
- db
- migration
# https://medium.com/faun/tech-edition-how-to-dockerize-a-django-web-app-elegantly-924c0b83575d
# Need to change settings.py to use OS env variables if using this
# environment section. Also need to update env variables
# in .bash_profile
# environment:
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# POSTGRES_USER: ${POSTGRES_USER}
# DJANGO_DB_NAME: ${DJANGO_DB_NAME}
# DJANGO_SU_NAME: ${DJANGO_SU_NAME}
# DJANGO_SU_EMAIL: ${DJANGO_SU_EMAIL}
# DJANGO_SU_PASSWORD: ${DJANGO_SU_PASSWORD}
# ********** set DJANGO_SECRET_KEY in Travis & Heroku website **********
# DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}