| |
| FROM python:3.11-slim |
|
|
| LABEL org.opencontainers.image.source=https://github.com/protectai/llm-guard |
| LABEL org.opencontainers.image.description="LLM Guard API" |
| LABEL org.opencontainers.image.licenses=MIT |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| && apt-get clean && rm -rf /var/lib/apt/lists/* |
|
|
| RUN useradd -m -u 1000 user |
| USER user |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| |
| |
| |
| ENV PYTHONUNBUFFERED 1 |
|
|
| |
| |
| ENV PYTHONDONTWRITEBYTECODE 1 |
|
|
| |
| WORKDIR $HOME/app |
|
|
| |
| COPY --chown=user:user pyproject.toml ./ |
| COPY --chown=user:user app ./app |
|
|
| |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install torch==2.0.1 --index-url https://download.pytorch.org/whl/cpu && \ |
| pip install --no-cache-dir ".[cpu]" |
|
|
| RUN python -m spacy download en_core_web_sm |
|
|
| COPY --chown=user:user ./config/scanners.yml ./config/scanners.yml |
|
|
| EXPOSE 7860 |
|
|
| CMD ["llm_guard_api", "config/scanners.yml"] |
|
|