-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
44 lines (44 loc) · 1.19 KB
/
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
services:
mysql:
container_name: db
image: mysql:latest
environment:
MYSQL_DATABASE: ${DB_NAME}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- '3306:3306'
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
# Run health check <start_period> seconds after container start.
start_period: 18s
# Proceeding checks are spaced by <interval> seconds
interval: 5s
# Fail check if it takes longer than 5
timeout: 5s
# Max 50 tries
retries: 50
env_file:
- .env
app:
container_name: sparesti-backend
depends_on:
mysql:
condition: service_healthy
build: .
# Make app container wait on mysql container to spin up by restarting it until mysql container is healthy
restart: always
volumes:
- ./images:/upload-dir
environment:
MYSQL_HOST: db
SPRING_DATASOURCE_URL: ${MYSQL_URL}
SPRING_DATASOURCE_USERNAME: ${MYSQL_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- '8080:8080'
env_file:
- .env
volumes:
mysql-data: