-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
39 lines (36 loc) · 1.05 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
39 lines (36 loc) · 1.05 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
services:
# Python APIサーバーの定義(前回作成したもの)
app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "8000:80"
volumes:
- ./src:/app/src
# DBが起動してからAPIサーバーが起動するように設定
depends_on:
- db
# 環境変数でデータベース接続情報をアプリに渡す
environment:
- DATABASE_URL=postgresql://user:password@db:5432/mydatabase
- PYTHONPATH=/app/src # srcディレクトリをPYTHONPATHに追加
# PostgreSQLデータベースの定義
db:
image: postgres:15-alpine # PostgreSQLのDockerイメージ
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- POSTGRES_DB=mydatabase
ports:
- "5432:5432" # PCの5432ポートに接続
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
volumes:
postgres_data: