Nephroscreen / Dockerfile
sadiqM's picture
Train model at Docker build time; stop committing binaries
382741d
Raw
History Blame Contribute Delete
640 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install dependencies first for better layer caching.
COPY requirements.txt pyproject.toml ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy source and install the package (makes `nephroscreen` importable).
COPY . .
RUN pip install --no-cache-dir -e .
# Train the model at build time (fast + deterministic: pinned deps, fixed seed).
# Keeps binaries out of git and guarantees the served model matches the code.
RUN python -m nephroscreen.train
EXPOSE 8000
# Render/Cloud Run set $PORT; default to 8000 locally.
CMD ["sh", "-c", "uvicorn api.main:app --host 0.0.0.0 --port ${PORT:-8000}"]