forked from nokia-wroclaw/innovativeproject-3s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
58 lines (53 loc) · 1.54 KB
/
docker-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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
version: '3.7'
# Define services
services:
# App backend service
app-server:
# Configuration for building the docker image for the backend service
build: ./server
ports:
- "8080:8080" # Forward the exposed port 8080 on the container to port 8080 on the host machine
restart: always
depends_on:
- db # This service depends on mysql. Start that first.
environment: # Pass environment variables to the service
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/db3s
#?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: 1q2w3e4r
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks: # Networks to join (Services on the same network can communicate with each other using their name)
- backend
- frontend
# Frontend Service
app-client:
build: ./front
ports:
- "4200:4200" # Map the exposed port 80 on the container to port 9090 on the host machine
restart: always
depends_on:
- app-server
networks:
- frontend
# Database Service (Mysql)
db:
image: mysql:latest
ports:
- "3306:3306"
restart: always
environment:
MYSQL_DATABASE: db3s
MYSQL_ROOT_PASSWORD: 1q2w3e4r
volumes:
- ./mysql-dump:/docker-entrypoint-initdb.d
- ./db_data:/var/lib/mysql
networks:
- backend
# Volumes
volumes:
db-data:
# Networks to be created to facilitate communication between containers
networks:
backend:
frontend: