Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
56 lines (52 loc) · 1.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
56 lines (52 loc) · 1.76 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# The whole stack in one command: `docker compose up --build`.
# db — PostgreSQL, the deployed database engine
# backend — the Spring app on the `demo` profile (Flyway builds the schema, seeders load demo data)
# frontend — the built React bundle served by nginx
#
# Values come from a .env file (copy .env.example -> .env). Every one has a safe local default so a
# bare `docker compose up` works on a laptop; override them for anything real.
name: pfms
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: ${DB_NAME:-pfms_db}
POSTGRES_USER: ${DB_USER:-pfms}
POSTGRES_PASSWORD: ${DB_PASSWORD:-pfms_secret}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
# The backend waits for this to pass (depends_on: service_healthy) so it never races the DB.
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-pfms} -d ${DB_NAME:-pfms_db}"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "5432:5432"
backend:
build: ./Backend
depends_on:
db:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: demo
DB_URL: jdbc:postgresql://db:5432/${DB_NAME:-pfms_db}
DB_USER: ${DB_USER:-pfms}
DB_PASSWORD: ${DB_PASSWORD:-pfms_secret}
JWT_SECRET: ${JWT_SECRET:-change-me-in-prod-at-least-32-characters-long}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:5173}
PORT: 8080
ports:
- "8080:8080"
frontend:
build:
context: ./Frontend
args:
# Baked into the bundle at build time (Vite). The browser talks to the backend on the host.
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8080}
depends_on:
- backend
ports:
- "5173:80"
volumes:
pgdata: