-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
44 lines (38 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
32
33
34
35
36
37
38
39
40
41
42
43
44
#Docker Compose file Reference (https://docs.docker.com/compose/compose-file/)
version: '3.8'
#Define services
services:
#PostgreSQL Database
restaurant-postgres:
image: "postgres:13"
restart: always
container_name: restaurant-postgres
ports:
- "5432:5432" #Forward the exposed port 5432 on the container to port 5432 on the host machine
volumes:
- restaurant-data:/var/lib/postgresql/data
#Environment variable for DB name, user and password
environment:
POSTGRES_DB: restaurant_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
#Flight Booking Service: Spring Boot Application
restaurant-service:
#The docker file in restaurant-service build the jar and provides the docker image with the following name.
build:
context: .
dockerfile: Dockerfile
restart: always
container_name: restaurant-service
hostname: restaurant-service
ports:
- "8080:8080"
depends_on:
- restaurant-postgres
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://restaurant-postgres:5432/restaurant_db
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: password
#Volumes for DB data
volumes:
restaurant-data: