forked from springframeworkguru/spring-boot-mysql-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
40 lines (40 loc) · 1.08 KB
/
docker-compose.yaml
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
version: '3'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: "$MYSQL_DB_DNAME"
# So you don't have to use root, but you can if you like
MYSQL_USER: "$MYSQL_DB_USERNAME"
# You can use whatever password you like
MYSQL_PASSWORD: "$MYSQL_DB_PASSWORD"
# Password for root access
MYSQL_ROOT_PASSWORD: "$MYSQL_DB_PASSWORD"
ports:
# <Host PORT> : < MySQL Port running inside container>
#Host port is used for outside communication
#MYSQL internal port used for Networked service-to-service communication
- '3000:3306'
volumes:
- my-db:/var/lib/mysql
web-app:
depends_on:
- db
restart: on-failure
links:
- "db:db"
environment:
MYSQL_DB_HOST: ${MYSQL_DB_HOST}
MYSQL_DB_PORT: ${MYSQL_DB_PORT}
MYSQL_DB_USERNAME: ${MYSQL_DB_USERNAME}
MYSQL_DB_PASSWORD: ${MYSQL_DB_PASSWORD}
MYSQL_DB_DNAME: ${MYSQL_DB_DNAME}
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
## Names our volume
volumes:
my-db: