Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
100 lines (94 loc) · 2.8 KB
/
Copy pathdocker-compose.yml
File metadata and controls
100 lines (94 loc) · 2.8 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Full-stack local development environment
# Usage: docker compose up
#
# The three built services set `pull_policy: build`, so `docker compose up` always
# rebuilds them from the working tree instead of silently reusing a months-old image.
# Layer caching keeps this cheap when nothing changed.
services:
# PostgreSQL database
postgres:
image: postgres:16-alpine
container_name: diabetes-db
environment:
POSTGRES_DB: diabetes_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# ASP.NET Core backend API
backend:
build: ./backend
pull_policy: build
container_name: diabetes-backend
ports:
- "8000:8000"
environment:
ASPNETCORE_ENVIRONMENT: Development
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/diabetes_db
CORS_ORIGINS: "*"
ML_URL: http://ml:5001
depends_on:
postgres:
condition: service_healthy
ml:
condition: service_started
# ML inference microservice (stateless Flask, port 5001)
ml:
build:
context: .
dockerfile: ml/Dockerfile
pull_policy: build
container_name: diabetes-ml
ports:
- "5001:5001"
environment:
DETECTOR_CKPT: /app/ml/data/checkpoints/xchannel_nll_pooled_best.pt
# checkpoint mounted read-only — swap the deliverable model without rebuilding
volumes:
- ./ml/data/checkpoints:/app/ml/data/checkpoints:ro
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5001/health')"]
interval: 10s
timeout: 5s
retries: 6
start_period: 60s
# Next.js frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
pull_policy: build
container_name: diabetes-frontend
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000/api
depends_on:
- backend
# NOTE: no source bind-mount. The image runs the Next.js standalone server against a
# prebuilt .next/, so mounting ./frontend/src changed nothing while looking like live
# reload — edits appeared to do nothing and a stale image served old code for days.
# pgAdmin (optional — for DB inspection)
pgadmin:
image: dpage/pgadmin4:latest
container_name: diabetes-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@dtu.dk
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "5050:80"
depends_on:
postgres:
condition: service_healthy
profiles:
- tools
volumes:
postgres_data: