-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
102 lines (97 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
version: "3.7"
services:
mysql:
image: mysql:5.7 # for m1 mac
platform: linux/amd64 # for m1 mac
command: "mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --default-time-zone='+9:00'"
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: yatter
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_USER: yatter
MYSQL_PASSWORD: yatter
volumes:
- "./.data/mysql:/var/lib/mysql"
- "./ddl:/docker-entrypoint-initdb.d"
# docより'コンテナ初回起動時に実行'とあったが,
# 実際にはdbデータを消すと毎起動で実行されることを確認
# 逆にdbデータが残ったままでimageを消してから再起動したり, no-cacheでビルドしても実行されずに元のデータのみだった
restart: on-failure
phpmyadmin:
image: phpmyadmin/phpmyadmin
platform: linux/amd64 # for m1 mac
depends_on:
- mysql
environment:
PMA_ARBITRARY: 1
PMA_HOSTS: mysql
PMA_USER: yatter
PMA_PASSWORD: yatter
ports:
- "3000:80"
volumes:
- "./.data/phpmyadmin:/sessions"
web:
build:
context: .
dockerfile: Dockerfile
target: dev
working_dir: "/work/yatter-backend-go"
command: ["air"]
volumes:
- ".:/work/yatter-backend-go"
- "./.data/go-pkg:/go/pkg/mod/cache"
ports:
- "8080:8080"
env_file:
- ./env/docker-compose-default.env
- ./env/docker-compose-test.env
depends_on:
- mysql
- testmysql
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/v1/health"]
interval: 1m
timeout: 10s
retries: 3
start_period: 30s
restart: on-failure
swagger-ui:
image: swaggerapi/swagger-ui
platform: linux/amd64 # for m1 mac
ports:
- "8081:8080"
volumes:
- ./openapi.yml:/data/openapi.yml
environment:
SWAGGER_JSON: /data/openapi.yml
testmysql:
image: mysql:5.7 # for m1 mac
platform: linux/amd64 # for m1 mac
command: "mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --default-time-zone='+9:00'"
ports:
- "3307:3306"
environment:
MYSQL_DATABASE: tatter
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_USER: tatter
MYSQL_PASSWORD: tatter
volumes:
- "./.data/testmysql:/var/lib/mysql"
- "./ddl:/docker-entrypoint-initdb.d"
restart: on-failure
testphpmyadmin:
image: phpmyadmin/phpmyadmin
platform: linux/amd64 # for m1 mac
depends_on:
- testmysql
environment:
PMA_ARBITRARY: 1
PMA_HOSTS: testmysql
PMA_USER: tatter
PMA_PASSWORD: tatter
ports:
- "3001:80"
volumes:
- "./.data/testphpmyadmin:/sessions"