Skip to content

Commit 1e6d070

Browse files
committed
Updated ReadME
1 parent f18d39a commit 1e6d070

4 files changed

Lines changed: 882 additions & 330 deletions

File tree

1_README.md

Lines changed: 0 additions & 268 deletions
This file was deleted.

Dockerfile

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
11
# oasis/models/crime_predictor/Dockerfile
2-
# Stage 1: Training
2+
3+
# ── Stage 1: Training ──────────────────────────
34
FROM python:3.11-slim AS trainer
45

6+
LABEL stage="training"
7+
58
WORKDIR /app
69
COPY requirements.txt .
7-
RUN pip install --no-cache-dir -r requirements.txt
10+
RUN pip install --no-cache-dir --upgrade pip \
11+
&& pip install --no-cache-dir -r requirements.txt
812

913
COPY . .
14+
1015
ARG DATA_URL
1116
RUN python train.py --data-url ${DATA_URL}
1217

13-
# Stage 2: Production (minimal)
18+
# ── Stage 2: Production (minimal) ─────────────
1419
FROM python:3.11-slim AS production
1520

21+
LABEL maintainer="Dreipfelt" \
22+
project="OASIS Security" \
23+
version="1.0" \
24+
description="Crime predictor inference API — CDSD Project"
25+
26+
# Utilisateur non-root (sécurité)
27+
RUN adduser --disabled-password --gecos "" appuser
28+
1629
WORKDIR /app
30+
31+
# Dépendances de serving uniquement (pas sklearn, statsmodels, etc.)
32+
COPY requirements-serving.txt .
33+
RUN pip install --no-cache-dir --upgrade pip \
34+
&& pip install --no-cache-dir -r requirements-serving.txt
35+
36+
# Artefact ML depuis le stage trainer
1737
COPY --from=trainer /app/models/crime_predictor.pkl ./models/
18-
COPY requirements.txt .
19-
RUN pip install --no-cache-dir -r requirements.txt
2038

39+
# Code applicatif
2140
COPY predict.py model.py config.yaml ./
41+
42+
USER appuser
43+
2244
EXPOSE 8000
2345

46+
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
47+
CMD curl -f http://localhost:8000/health || exit 1
48+
2449
CMD ["uvicorn", "predict:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)