-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (55 loc) · 2.29 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (55 loc) · 2.29 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
# ── OmicPath Dockerfile ───────────────────────────────────────────────────────
# Multi-stage build: keeps final image lean
# Stage 1 — builder
FROM python:3.12-slim AS builder
WORKDIR /app
# System deps for OpenSlide (.svs support) + h5py
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libopenslide-dev \
libhdf5-dev \
git \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir \
openslide-python \
"medical-ai-middleware[all] @ git+https://github.com/moebouassida/medical-ai-middleware.git" \
&& pip install --no-cache-dir --no-deps histoprep==2.0.5
# Stage 2 — runtime
FROM python:3.12-slim AS runtime
WORKDIR /app
# Runtime system deps only
RUN apt-get update && apt-get install -y --no-install-recommends \
libopenslide0 \
libhdf5-310 \
&& rm -rf /var/lib/apt/lists/*
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy project
COPY src/ ./src/
COPY config/ ./config/
COPY data/rna/processed/ ./data/rna/processed/
# These are mounted at runtime (not baked into image):
# /app/checkpoints ← model weights
# /app/data/wsi_features ← WSI features (optional)
# /app/logs ← audit logs
# Create dirs
RUN mkdir -p checkpoints data/wsi_features logs results
# Non-root user for security
RUN useradd -m -u 1000 omicpath && chown -R omicpath:omicpath /app
USER omicpath
# Env defaults (override via docker-compose or -e flags)
ENV CONFIG_PATH=config/config.yaml \
CKPT_PATH=checkpoints/best_fold2.pt \
CALIB_PATH=checkpoints/calibration_ensemble.json \
LLM_BACKEND=openrouter \
LLM_MODEL=anthropic/claude-sonnet-4-5 \
MAX_PATCHES=2048 \
PORT=8000
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/health').raise_for_status()"
CMD uvicorn src.app:app --host 0.0.0.0 --port $PORT --workers 1