-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
43 lines (39 loc) · 1.03 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.9'
# 定义服务列表
services:
# 定义名为app的服务
app:
# 构建服务所需的Docker镜像
build:
# 设置构建上下文(即Dockerfile所在目录)
context: .
args:
- DEV=true
# 将容器的8000端口映射到主机的8000端口
ports:
- "8000:8000"
# 将主机上的./app文件夹挂载到容器的/app文件夹
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"
environment:
- DB_HOST=db
- DB_NAME=devdb
- DB_USER=devuser
- DB_PASS=changeme
depends_on:
- db
db:
image: postgres:13-alpine
volumes:
- dev-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=devdb
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=changeme
volumes:
dev-db-data: