-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
68 lines (67 loc) · 1.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
version: "3"
services:
dbserver:
container_name: mysql5.7-spring
image: mysql:5.7
environment:
MYSQL_DATABASE: kotlin_restapi_db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
expose:
- 3306
ports:
- "3306:3306"
volumes:
# 起動スクリプト
- ./docker/mysql/initdb:/docker-entrypoint-initdb.d
# MySQLの設定ファイル
- ./docker/mysql/config:/etc/mysql/conf.d
# DBの永続化
- mysql_db:/var/lib/mysql
spring:
container_name: backend-spring-app
build: ./docker/spring
depends_on:
# dbserverが起動してから、appを起動
- dbserver
ports:
- "8081:8081"
volumes:
- ./backend:/app
environment:
# mysqlの接続設定 host:portはコンテナ名指定
spring.datasource.driverClassName: "com.mysql.cj.jdbc.Driver"
spring.datasource.url: "jdbc:mysql://dbserver/kotlin_restapi_db"
spring.datasource.username: "user"
spring.datasource.password: "password"
working_dir: /app
tty: true
command: sh -c "gradle build -x test && java -jar -Dspring.profiles.active=docker-compose ./build/libs/kotlin_restapi-0.0.1-SNAPSHOT.jar"
vue:
build: ./docker/vue
container_name: front-vue-app
depends_on:
- spring
ports:
- "3000:3000"
volumes:
- ./Front:/app
working_dir: /app
tty: true
command: sh -c "yarn && yarn run vite --host"
nginx:
image: nginx
container_name: front-nginx
depends_on:
- vue
ports:
- 80:80
environment:
- TZ=Asia/Tokyo
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
# DBの永続化先
volumes:
mysql_db:
driver: local