|
| 1 | +ARG PYTHON=3.13 |
| 2 | + |
| 3 | +# Use a multi-stage build to create a lightweight production image |
| 4 | +FROM docker.io/python:${PYTHON}-slim as builder |
| 5 | + |
| 6 | +# Copy repository files |
| 7 | +COPY / /src |
| 8 | + |
| 9 | +# Create a venv and install guidellm |
| 10 | +RUN python3 -m venv /opt/guidellm \ |
| 11 | + && /opt/guidellm/bin/pip install --no-cache-dir /src |
| 12 | + |
| 13 | +# Copy entrypoint script into the venv bin directory |
| 14 | +RUN install -m0755 /src/deploy/entrypoint.sh /opt/guidellm/bin/entrypoint.sh |
| 15 | + |
| 16 | +# Prod image |
| 17 | +FROM docker.io/python:${PYTHON}-slim |
| 18 | + |
| 19 | +# Copy the virtual environment from the builder stage |
| 20 | +COPY --from=builder /opt/guidellm /opt/guidellm |
| 21 | + |
| 22 | +# Add guidellm bin to PATH |
| 23 | +ENV PATH="/opt/guidellm/bin:$PATH" |
| 24 | + |
| 25 | +# Create a non-root user |
| 26 | +RUN useradd -md /results guidellm |
| 27 | + |
| 28 | +# Switch to non-root user |
| 29 | +USER guidellm |
| 30 | + |
| 31 | +# Set working directory |
| 32 | +WORKDIR /results |
| 33 | + |
| 34 | +# Metadata |
| 35 | +LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm" \ |
| 36 | + org.opencontainers.image.description="GuideLLM Performance Benchmarking Container" |
| 37 | + |
| 38 | +# Set the environment variable for the benchmark script |
| 39 | +# TODO: Replace with scenario environment variables |
| 40 | +ENV GUIDELLM_TARGET="http://localhost:8000" \ |
| 41 | + GUIDELLM_MODEL="neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16" \ |
| 42 | + GUIDELLM_RATE_TYPE="sweep" \ |
| 43 | + GUIDELLM_DATA="prompt_tokens=256,output_tokens=128" \ |
| 44 | + GUIDELLM_MAX_REQUESTS="100" \ |
| 45 | + GUIDELLM_MAX_SECONDS="" \ |
| 46 | + GUIDELLM_OUTPUT_PATH="/results/results.json" |
| 47 | + |
| 48 | +ENTRYPOINT [ "/opt/guidellm/bin/entrypoint.sh" ] |
0 commit comments