-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
60 lines (56 loc) · 1.41 KB
/
docker-compose.yml
File metadata and controls
60 lines (56 loc) · 1.41 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
version: '3.8'
services:
# MySQL Database
mysql:
image: mysql:8.0
container_name: world-api-mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: world
MYSQL_USER: worlduser
MYSQL_PASSWORD: worldpassword
ports:
- "3306:3306"
volumes:
# Persist database data
- mysql_data:/var/lib/mysql
# Initialize with world database dump
- ./init-scripts:/docker-entrypoint-initdb.d
networks:
- world-api-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Spring Boot Application
app:
build:
context: .
dockerfile: Dockerfile
container_name: world-api-app
environment:
# Database connection
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/world
DB_USER: worlduser
DB_PASSWORD: worldpassword
# Optional: Set Spring profile
SPRING_PROFILES_ACTIVE: dev
# JVM options (optional override)
JAVA_OPTS: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
ports:
- "8080:8080"
depends_on:
mysql:
condition: service_healthy
networks:
- world-api-network
# Restart policy
restart: unless-stopped
networks:
world-api-network:
driver: bridge
volumes:
mysql_data:
driver: local