-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
109 lines (104 loc) · 2.73 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
services:
api:
build:
context: ./backend
dockerfile: Dockerfile.dev
image: markdown-blog-api:latest
ports:
- 8088:8088
expose:
- 8088
volumes:
- ./backend:/usr/src/app/backend
- /usr/src/app/target
working_dir: /usr/src/app/backend
networks:
- mynet
env_file:
- ./backend/.env
depends_on:
- db
# - minio
deploy:
replicas: 1
labels:
- "traefik.enable=true"
- "traefik.http.routers.markdown-blog-api.entrypoints=web"
- "traefik.http.routers.markdown-blog-api.rule=Host(`localhost`)"
- "traefik.http.routers.markdown-blog-api.middlewares=cors@file"
- "traefik.http.services.markdown-blog-api.loadbalancer.server.port=8088"
db:
image: postgres:15
ports:
- "5432:5432"
env_file:
- ./backend/.env
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
- POSTGRES_DB=markdown-blog
volumes:
- postgresql_data:/var/lib/postgresql/data
networks:
- mynet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U root -d markdown-blog"]
interval: 10s
timeout: 5s
retries: 5
reverse-proxy:
image: traefik:3.1.2
command:
- "--log.level=DEBUG"
- "--api.insecure=true" # 開発環境用、本番ではfalse.
- "--providers.docker=true"
- "--providers.docker.exposedByDefault=false"
- "--entryPoints.web.address=:80"
- "--entryPoints.dashboard.address=:8081"
- "--providers.docker.network=mynet"
# Traefikのダッシュボード
- "--api.dashboard=true"
# アクセスログ
- "--accesslog=true"
- "--accesslog.filePath=/logs/access.log"
- "--accesslog.format=json"
# ミドルウェア用
- "--providers.file.filename=/etc/traefik.yml"
- "--providers.file.watch=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik-logs:/logs
- ./backend/traefik/traefik.yml:/etc/traefik.yml
deploy:
placement:
constraints:
- node.role == manager
ports:
- 80:80
- 8081:8081 # Traefikのダッシュボード用
networks:
- mynet
# minio:
# image: minio/minio
# ports:
# - "9000:9000"
# - "9001:9001"
# volumes:
# - minio_storage:/data
# env_file:
# - backend/.env
# environment:
# MINIO_ROOT_USER: ${MINIO_ROOT_USER}
# MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
# MINIO_BUCKET_NAME: ${MINIO_BUCKET_NAME}
# command: server --console-address ":9001" /data
# networks:
# - mynet
networks:
mynet:
driver: "bridge"
attachable: true
volumes:
postgresql_data:
traefik-logs:
# minio_storage: {}