-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
43 lines (39 loc) · 1.19 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
version: "3.8"
volumes:
db-data:
static-data:
services:
db:
platform: linux/amd64
restart: unless-stopped
image: postgres:12.8-alpine
volumes:
- db-data:/var/lib/postgresql/data
env_file:
- ./django_backend/.env
backend:
restart: unless-stopped
env_file:
- ./django_backend/.env
build:
context: ./django_backend
target: dev
dockerfile: ./Dockerfile
args:
requirements_file: "base.txt"
ports:
- "8111:8000"
# Use for when you need the container up but not the dev server (e.g., initial migrations).
# Note that the config change will trigger compose to reinstance the container.
# command: bash -c "waitforit -host=db -port=5432 --timeout 30 && echo ready && sleep infinity"
command: bash -c "waitforit -host=db -port=5432 --timeout 30 &&
python3 /code/manage.py collectstatic --no-input &&
python3 /code/manage.py migrate &&
python3 /code/manage.py initadmin &&
python3 /code/manage.py fakedata &&
python3 /code/manage.py runserver 0.0.0.0:8000"
depends_on:
- db
volumes:
- static-data:/static
- ./django_backend/:/code