-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yaml
75 lines (70 loc) · 1.6 KB
/
docker-compose.yaml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
version: '3'
services:
# Nginxコンテナ
nginx:
container_name: nginx_fastapi_spro
image: nginx:alpine
depends_on:
- app
- db
environment:
TZ: "Asia/Tokyo"
ports:
- "80:80"
- "443:443"
volumes:
- ./docker_conf/nginx/conf.d:/etc/nginx/conf.d
- ./docker_conf/nginx/ssl:/etc/nginx/ssl
networks:
fastapi_spro:
ipv4_address: 172.27.1.11
# アプリケーションコンテナ
app:
build:
context: .
dockerfile: Dockerfile
container_name: app_fastapi_spro
volumes:
- .:/fastapi/
- /var/run/docker.sock:/var/run/docker.sock
environment:
- HOSTPWD=${PWD}
- PYTHONPATH=/fastapi
expose:
- 8000
depends_on:
- db
# args: host port user password database
entrypoint: /fastapi/docker_conf/wait_postgres.sh db 5432 root password spro
command: bash /fastapi/docker_conf/runner.sh
restart: always
tty: true
networks:
fastapi_spro:
ipv4_address: 172.27.1.12
# DBコンテナ
db:
image: postgres:12.4-alpine
container_name: db_fastapi_spro
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
- POSTGRES_DB=spro
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --locale=C
- PGDATA=/var/lib/postgresql/data/fastapi
volumes:
- ./db_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
fastapi_spro:
ipv4_address: 172.27.1.13
volumes:
db_data:
driver: local
networks:
fastapi_spro:
ipam:
driver: default
config:
- subnet: 172.27.1.0/24