-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
41 lines (36 loc) · 1.25 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
version: '3.8'
# Define services
services:
# App backend service
app:
# Configuration for building the docker image for the backend service
container_name: "docker-app"
build:
context: . # Use an image built from the specified dockerfile in the `springboot-app-server` directory.
dockerfile: Dockerfile
ports:
- "8080:8080" # Forward the exposed port 4000 on the container to port 4000 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/dockerdb?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
SPRING_DATASOURCE_USERNAME: admin
SPRING_DATASOURCE_PASSWORD: admin
# Database Service (Mysql)
db:
image: mysql:8
container_name: "docker-db"
ports:
- "3306:3306"
restart: always
environment:
MYSQL_DATABASE: dockerdb
MYSQL_USER: admin #username to connect with database (new username)
MYSQL_PASSWORD: admin #password to connect with database (new password)
MYSQL_ROOT_PASSWORD: root # master user password
volumes:
- db-data:/var/lib/mysql
# Volumes
volumes:
db-data: