-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
64 lines (58 loc) · 1.69 KB
/
docker-compose.prod.yml
File metadata and controls
64 lines (58 loc) · 1.69 KB
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
services:
# Python APIサーバーの定義(前回作成したもの)
app:
build:
context: .
dockerfile: Dockerfile.prod
ports:
- "8000:80"
volumes:
- ./src:/app/src
# DBが起動してからAPIサーバーが起動するように設定
depends_on:
- db
# 環境変数でデータベース接続情報をアプリに渡す
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- PYTHONPATH=/app/src # srcディレクトリをPYTHONPATHに追加
# PostgreSQLデータベースの定義
db:
image: postgres:15-alpine # PostgreSQLのDockerイメージ
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- "5432:5432" # PCの5432ポートに接続
command: postgres -c log_destination=stderr -c log_statement=all -c log_connections=on -c log_disconnections=on
logging:
options:
max-size: "10k"
max-file: "5"
volumes:
- postgres_data:/var/lib/postgresql/data/
# add adminer service
adminer:
image: adminer
restart: always
ports:
- "8080:8080" # access the adminer with 8080 port on the host
nginx:
image: nginx:1.25
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
depends_on:
- app
restart: always
certbot:
image: certbot/certbot
volumes:
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
volumes:
postgres_data: