-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlocal-docker-compose.yml
More file actions
38 lines (34 loc) · 1.26 KB
/
local-docker-compose.yml
File metadata and controls
38 lines (34 loc) · 1.26 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
version: '3.8'
services:
db:
image: mysql:5.7
container_name: db
restart: always
ports:
- "3306:3306" # MySQL uses port 3306
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} # Set your desired MySQL root password
MYSQL_DATABASE: ${DB_NAME} # Replace with your desired database name
MYSQL_USER: ${DB_USER} # Replace with your desired MySQL username
MYSQL_PASSWORD: ${DB_PASSWORD} # Replace with your desired MySQL password
volumes:
- db_data:/var/lib/mysql
app:
container_name: app
build:
context: .
ports:
- "8080:8080"
environment:
- "SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/${DB_NAME}" # Replace 'your_database_name' with the same name you used for MYSQL_DATABASE in the db service.
- "SPRING_DATASOURCE_USERNAME=${DB_USER}" # Replace 'your_mysql_user' with the same name you used for MYSQL_USER in the db service.
- "SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD}" # Replace 'your_mysql_password' with the same name you used for MYSQL_PASSWORD in the db service.
depends_on:
- db
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
volumes:
db_data: