-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
68 lines (63 loc) · 2.04 KB
/
Copy pathdocker-compose.yml
File metadata and controls
68 lines (63 loc) · 2.04 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
61
62
63
64
65
66
67
68
# Docker Compose file Reference (https://docs.docker.com/compose/compose-file/)
version: '3.7'
services:
# Backend service
spring-api:
build:
context: .
dockerfile: Spring.Dockerfile
ports:
- "8080:8080" # Forward the exposed port 8080 on the container to port 8080 on the host machine
- "5005:5005" # Expose the debug port 5005 on the container to port 5005 on the host machine
restart: on-failure
depends_on:
- mysql-db # This service depends on mysql. Start that first.
environment: # Pass environment variables to the service
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-db:3306/employeemanager?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: radu
SPRING_DATASOURCE_PASSWORD: radu123456
APPLICATION_START_DELAY_IN_SECONDS: 40
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
networks: # Networks to join (Services on the same network can communicate with each other using their name)
- backend
- frontend
# Frontend Service
angular-client:
build:
context: ./employeemanager-angular
dockerfile: Angular.Dockerfile
args:
API_BASE_URL: http://127.0.0.1:8080/
ports:
- "8081:80" # Map the exposed port 80 on the container to port 8081 on the host machine
restart: unless-stopped
depends_on:
- spring-api
networks:
- frontend
# Database Service (Mysql)
mysql-db:
image: docker.io/mysql:8.0
ports:
- "3306:3306"
restart: unless-stopped
environment:
MYSQL_DATABASE: employeemanager
MYSQL_USER: radu
MYSQL_PASSWORD: radu123456
MYSQL_ROOT_PASSWORD: root123456
volumes:
- mysql-db:/var/lib/mysql
networks:
- backend
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 30s
timeout: 30s
retries: 5
# Networks to be created to facilitate communication between containers
networks:
backend:
frontend:
volumes:
mysql-db: