-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
43 lines (40 loc) · 1.12 KB
/
docker-compose.yml
File metadata and controls
43 lines (40 loc) · 1.12 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
version: '3.8'
services:
mysql:
image: mysql:8.0
container_name: mysql-container
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: libraryapidb
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbuser
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./src/main/resources/static:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
command: --default-authentication-plugin=mysql_native_password --bind-address=0.0.0.0
spring-app:
build: .
container_name: spring-boot-app
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-container:3306/libraryapidb?allowPublicKeyRetrieval=true&useSSL=false
SPRING_DATASOURCE_USERNAME: dbuser
SPRING_DATASOURCE_PASSWORD: dbuser
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SPRING_JPA_SHOW_SQL: "true"
ports:
- "8080:8080"
volumes:
mysql_data:
driver: local