Download deployment/Dockerfile.ml-inference from shaikhsalman/devsecops-platform: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/shaikhsalman/devsecops-platform/resolve/main/deployment/Dockerfile.ml-inference
- Command line
-
hf download hf://shaikhsalman/devsecops-platform/deployment/Dockerfile.ml-inference
-
curl -L -o Dockerfile.ml-inference https://huggingface.co/shaikhsalman/devsecops-platform/resolve/main/deployment/Dockerfile.ml-inference
1.34 kB
| # ============================================================================= | |
| # Hardened Dockerfile — ML Inference Server | |
| # ============================================================================= | |
| FROM python:3.12-slim AS builder | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /build | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --require-hashes -r requirements.txt | |
| COPY src/ /build/src/ | |
| # --- Runtime --- | |
| FROM python:3.12-slim AS runtime | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgomp1 && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN groupadd -g 1000 mluser && \ | |
| useradd -u 1000 -g mluser -s /bin/bash mluser | |
| COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages | |
| COPY --from=builder /build/src/ /app/src/ | |
| WORKDIR /app | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| TRANSFORMERS_CACHE=/cache/huggingface | |
| USER mluser | |
| EXPOSE 8000 | |
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | |
| CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] | |
| ENTRYPOINT ["python", "-m", "vllm.entrypoints.openai.api_server", \ | |
| "--host", "0.0.0.0", "--port", "8000", \ | |
| "--model", "/models/latest"] | |