-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
49 lines (46 loc) · 1.1 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
45
46
47
48
49
services:
db:
image: postgres:latest
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: mydatabase
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
DB_HOST: db
DB_PORT: 5432
networks:
- mynetwork
server:
build:
context: .
dockerfile: server/Dockerfile
command: >
sh -c "
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py createadmin &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- ./server:/server
ports:
- "8000:8000"
depends_on:
- db
networks:
- mynetwork
environment:
- DATABASE_URL=postgres://myuser:mypassword@db:5432/mydatabase
- POSTGRES_DB=mydatabase
- POSTGRES_USER=myuser
- POSTGRES_PASSWORD=mypassword
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- ADMIN_USER=admin_user
- ADMIN_PASSWORD=secure_password
- ALLOWED_HOSTS=localhost
networks:
mynetwork:
volumes:
postgres_data: