forked from Meg-D/TheGiftLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
31 lines (28 loc) · 1.22 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
version: '3.3'
services:
#service 1: definition of mysql database
db:
image: mysql/mysql-server:latest
container_name: mysql-db2
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=root
ports:
- "3306:3306"
restart: always
#service 3: definition of your spring-boot app
thegiftlibrary: #it is just a name, which will be used only in this file.
image: thegiftlibrary #name of the image after dockerfile executes
container_name: thegiftlibrary-app #name of the container created from docker image
build:
context: . #docker file path (. means root directory)
dockerfile: Dockerfile #docker file name
ports:
- "8888:8888" #docker container port with your os port
restart: always
depends_on: #define dependencies of this app
- db #dependency name (which is defined with this name 'db' in this file earlier)
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/tgl?createDatabaseIfNotExist=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: password