-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
48 lines (38 loc) · 1.52 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
version: '3.3'
services:
#service 1: definition of mysql database
mysql-db:
image: mysql:5.7
container_name: mysql-db
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_PASSWORD=root
- MYSQL_DATABASE=BooksMphasis
- MYSQL_ROOT_HOST=%
ports:
- "3306:3306"
restart: always
#service 2: definition of phpMyAdmin
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: my-php-myadmin
ports:
- "8082:80"
restart: always
depends_on:
- mysql-db
environment:
- PMA_HOST=mysql-db
#service 3: definition of your spring-boot app
books: #it is just a name, which will be used only in t` image: books #name of the image after dockerfile executes
container_name: books-service #name of the container created from docker image
build: .
ports:
- "8080:8080" #docker containter port with your os port
restart: always
depends_on: #define dependencies of this app
- mysql-db #dependency name (which is defined with this name 'db' in this file earlier)
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-db:3306/BooksMphasis?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&useUnicode=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root