1 |
f3e8b06e
|
Jakub Smid
|
version: '3.8'
|
2 |
|
|
|
3 |
|
|
services:
|
4 |
|
|
db: # PostgreSQL database
|
5 |
|
|
image: postgres:14.2
|
6 |
|
|
container_name: postgres-db
|
7 |
|
|
environment:
|
8 |
|
|
- POSTGRES_DB=test # database name
|
9 |
|
|
- POSTGRES_USER=test # database user
|
10 |
|
|
- POSTGRES_PASSWORD=Password.123 # database password
|
11 |
|
|
expose:
|
12 |
|
|
- 5432
|
13 |
|
|
ports:
|
14 |
|
|
- "5432:5432" # expose port 5432 (PostgreSQL) out of the docker container to the local machine
|
15 |
0319d5a2
|
Jakub Smid
|
volumes:
|
16 |
|
|
- db-data:/var/lib/postgresql/data
|
17 |
f3e8b06e
|
Jakub Smid
|
|
18 |
|
|
|
19 |
|
|
app: # Spring boot application
|
20 |
|
|
build: .
|
21 |
|
|
container_name: app-backend # name of the container
|
22 |
369e0228
|
Schwobik
|
image: schwobik/backend-app:1.2
|
23 |
f3e8b06e
|
Jakub Smid
|
ports:
|
24 |
220bfa94
|
mschwob
|
- "8080:8080" # expose port 8080 out of the docker container do the local machine
|
25 |
f3e8b06e
|
Jakub Smid
|
depends_on:
|
26 |
|
|
- db
|
27 |
|
|
environment:
|
28 |
|
|
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/test # overwrites application.properties datasource url to connect to the database
|
29 |
|
|
|
30 |
0319d5a2
|
Jakub Smid
|
frontend:
|
31 |
b539ef29
|
Jakub Smid
|
# Since our Dockerfile for web-server is located in react-app folder, our build context is ./react-app
|
32 |
0319d5a2
|
Jakub Smid
|
build: ../frontend
|
33 |
|
|
container_name: frontend
|
34 |
369e0228
|
Schwobik
|
image: schwobik/frontend-app:1.2
|
35 |
0319d5a2
|
Jakub Smid
|
ports:
|
36 |
220bfa94
|
mschwob
|
- "80:80"
|
37 |
0319d5a2
|
Jakub Smid
|
|
38 |
f3e8b06e
|
Jakub Smid
|
volumes:
|
39 |
|
|
db-data:
|