-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
37 lines (33 loc) · 1.09 KB
/
docker-compose.yml
File metadata and controls
37 lines (33 loc) · 1.09 KB
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
version: '3.8'
services:
postgres-db:
image: postgres:16 # Using a specific version is good practice
container_name: postgres-db
environment:
POSTGRES_DB: matchenginedb
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- "5432:5432" # Map host port to container port for local access if needed
volumes:
- ./db-data:/var/lib/postgresql/data # Persist data on the host machine
- ./init-scripts:/docker-entrypoint-initdb.d # Mount initialization scripts
networks:
- app-network
match-engine-app:
build: . # Build the image from the Dockerfile in the current directory
container_name: match-engine-app
ports:
- "8080:8080"
depends_on:
- postgres-db # Ensure the database is ready before the app starts
environment:
# The app will connect to the DB using the service name 'postgres-db'
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres-db:5432/matchenginedb
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
db-data: # Explicitly define the volume for clarity