-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
32 lines (29 loc) · 1.28 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
version: '3.3'
services:
#service 1: definition of mysql database
mysql-db2:
image: mysql:latest
container_name: mysql-db2
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_PASSWORD=admin
- MYSQL_DATABASE=demo
ports:
- "3307:3306"
tty: true
#service 2: definition of your spring-boot app
dcbservice: #it is just a name, which will be used only in this file.
image: dcb-service #name of the image after dockerfile executes
container_name: dcb-service-app #name of the container created from docker image
build:
context: . #docker file path (. means root directory)
dockerfile: Dockerfile #docker file name
ports:
- "8082:8082" #docker containter port with your os port
restart: always
depends_on: #define dependencies of this app
- mysql-db2 #dependency name (which is defined with this name 'db' in this file earlier)
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-db2:3306/dcbapp?createDatabaseIfNotExist=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: admin