-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
52 lines (48 loc) · 1.34 KB
/
Copy pathdocker-compose.yml
File metadata and controls
52 lines (48 loc) · 1.34 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
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: nexusdb
POSTGRES_USER: nexus
POSTGRES_PASSWORD: nexus_dev_password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nexus -d nexusdb"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
backend-csharp:
build:
context: ./backend-csharp
dockerfile: Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__DefaultConnection=Host=postgres;Database=nexusdb;Username=nexus;Password=nexus_dev_password
ports:
- "5000:8080"
depends_on:
postgres:
condition: service_healthy
profiles:
- csharp
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- VITE_API_URL=http://localhost:5000
profiles:
- csharp
volumes:
postgres_data:
# Il backend espone la porta 5000 sull'host mappata su 8080 nel container.
# Il frontend punta sempre a localhost:5000.
# Il healthcheck su postgres e' necessario.
# Senza, il backend parte prima che PostgreSQL sia pronto ad accettare connessioni e crasha.
# depends_on con condition: service_healthy risolve la race condition di startup.