diff --git a/README.md b/README.md index 9312c55f..b1abc75f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,25 @@ pip install git+https://github.com/vllm-project/guidellm.git For detailed installation instructions and requirements, see the [Installation Guide](https://github.com/vllm-project/guidellm/blob/main/docs/install.md). +### With Podman / Docker + +Alternatively we publish container images at [ghcr.io/vllm-project/guidellm](https://github.com/vllm-project/guidellm/pkgs/container/guidellm). Running a container is (by default) equivalent to `guidellm benchmark run`: + +```bash +podman run \ + --rm -it \ + -v "./results:/results:rw" \ + -e GUIDELLM_TARGET=http://localhost:8000 \ + -e GUIDELLM_RATE_TYPE=sweep \ + -e GUIDELLM_MAX_SECONDS=30 \ + -e GUIDELLM_DATA="prompt_tokens=256,output_tokens=128" \ + ghcr.io/vllm-project/guidellm:latest +``` + +> [!TIP] CLI options can also be specified as ENV variables (E.g. `--rate-type sweep` -> `GUIDELLM_RATE_TYPE=sweep`). If both are specified then the CLI option overrides the the ENV. + +Replace `latest` with `stable` for the newest tagged release or set a specific release if desired. + ### Quick Start #### 1. Start an OpenAI Compatible Server (vLLM) diff --git a/deploy/Containerfile b/deploy/Containerfile index 2702e24d..7715de93 100644 --- a/deploy/Containerfile +++ b/deploy/Containerfile @@ -1,26 +1,26 @@ -ARG PYTHON=3.13 +ARG BASE_IMAGE=docker.io/python:3.13-slim # Use a multi-stage build to create a lightweight production image -FROM docker.io/python:${PYTHON}-slim as builder +FROM $BASE_IMAGE as builder + +# Ensure files are installed as root +USER root # Copy repository files -COPY / /src +COPY / /opt/app-root/src # Create a venv and install guidellm -RUN python3 -m venv /opt/guidellm \ - && /opt/guidellm/bin/pip install --no-cache-dir /src - -# Copy entrypoint script into the venv bin directory -RUN install -m0755 /src/deploy/entrypoint.sh /opt/guidellm/bin/entrypoint.sh +RUN python3 -m venv /opt/app-root/guidellm \ + && /opt/app-root/guidellm/bin/pip install --no-cache-dir /opt/app-root/src # Prod image -FROM docker.io/python:${PYTHON}-slim +FROM $BASE_IMAGE # Copy the virtual environment from the builder stage -COPY --from=builder /opt/guidellm /opt/guidellm +COPY --from=builder /opt/app-root/guidellm /opt/app-root/guidellm # Add guidellm bin to PATH -ENV PATH="/opt/guidellm/bin:$PATH" +ENV PATH="/opt/app-root/guidellm/bin:$PATH" # Create a non-root user RUN useradd -md /results guidellm @@ -35,14 +35,8 @@ WORKDIR /results LABEL org.opencontainers.image.source="https://github.com/vllm-project/guidellm" \ org.opencontainers.image.description="GuideLLM Performance Benchmarking Container" -# Set the environment variable for the benchmark script -# TODO: Replace with scenario environment variables -ENV GUIDELLM_TARGET="http://localhost:8000" \ - GUIDELLM_MODEL="neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16" \ - GUIDELLM_RATE_TYPE="sweep" \ - GUIDELLM_DATA="prompt_tokens=256,output_tokens=128" \ - GUIDELLM_MAX_REQUESTS="100" \ - GUIDELLM_MAX_SECONDS="" \ - GUIDELLM_OUTPUT_PATH="/results/results.json" - -ENTRYPOINT [ "/opt/guidellm/bin/entrypoint.sh" ] +# Argument defaults can be set with GUIDELLM_ +ENV GUIDELLM_OUTPUT_PATH="/results/benchmarks.json" + +ENTRYPOINT [ "/opt/app-root/guidellm/bin/guidellm" ] +CMD [ "benchmark", "run" ] diff --git a/deploy/entrypoint.sh b/deploy/entrypoint.sh deleted file mode 100755 index d6ff4ea0..00000000 --- a/deploy/entrypoint.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Path to the guidellm binary -guidellm_bin="/opt/guidellm/bin/guidellm" - -# If we receive any arguments switch to guidellm command -if [ $# -gt 0 ]; then - echo "Running command: guidellm $*" - exec $guidellm_bin "$@" -fi - -# Get a list of environment variables that start with GUIDELLM_ -args="$(printenv | cut -d= -f1 | grep -E '^GUIDELLM_')" - -# NOTE: Bash array + exec prevent shell escape issues -CMD=("${guidellm_bin}" "benchmark") - -# Parse environment variables for the benchmark command -for var in $args; do - # Remove GUIDELLM_ prefix - arg_name="${var#GUIDELLM_}" - - # If there is an extra underscore at the - # start than this is a config variable - if [ "${arg_name:0:1}" == "_" ]; then - continue - fi - - # Convert to lowercase - arg_name="${arg_name,,}" - # Replace underscores with dashes - arg_name="${arg_name//_/-}" - - # Add the argument to the command array if set - if [ -n "${!var}" ]; then - CMD+=("--${arg_name}" "${!var}") - fi -done - -# Execute the command -echo "Running command: ${CMD[*]}" -exec "${CMD[@]}"