-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
43 lines (38 loc) · 1.33 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
version: '3.9'
services:
postgres:
image: postgres:latest # Use the latest PostgreSQL image from Docker Hub
ports:
- "5432:5432" # Map container port 5432 to host port 5432
environment:
POSTGRES_DB: postgres # Specify the name of the database
POSTGRES_USER: postgres # Specify the database username
POSTGRES_PASSWORD: postgres # Specify the database password
volumes:
- postgres-data:/var/lib/postgresql/data # Mount volume for persistent data storage
networks:
- app-network
backend:
build: ./backend # Specify the path to the backend Dockerfile
ports:
- "8080:8080" # Map container port 8080 to host port 8080
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/postgres
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
depends_on:
- postgres # Ensure PostgreSQL is started before the backend
networks:
- app-network
frontend:
build: ./frontend # Specify the path to the frontend Dockerfile
ports:
- "5173:5173" # Map container port 5137 to host port 5137
depends_on:
- backend # Ensure backend is started before the frontend
networks:
- app-network
networks:
app-network:
volumes:
postgres-data: # Define a volume for PostgreSQL data persistence