Skip to content

Add Ubi container #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deploy/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm"

# Set the environment variable for the benchmark script
# TODO: Replace with scenario environment variables
ENV GUIDELLM_TARGET="http://localhost:8000" \
ENV GUIDELLM_BIN="/opt/guidellm/bin/guidellm" \
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" \
Expand Down
54 changes: 54 additions & 0 deletions deploy/Containerfile.ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG PYTHON=312

# Use a multi-stage build to create a lightweight production image

FROM registry.access.redhat.com/ubi9/python-${PYTHON}-minimal as builder

USER root

# Copy repository files
COPY / /opt/app-root/src

# Create a venv and install guidellm
RUN python3 -m venv /opt/app-root/guidellm \
&& /opt/app-root/guidellm/bin/pip install --no-cache-dir /opt/app-root/src

# Copy entrypoint script into the venv bin directory
RUN install -m0755 /opt/app-root/src/deploy/entrypoint.sh /opt/app-root/guidellm/bin/entrypoint.sh

# Prod image
FROM registry.access.redhat.com/ubi9/python-${PYTHON}-minimal

USER root

# Copy the virtual environment from the builder stage
COPY --from=builder /opt/app-root/guidellm /opt/app-root/guidellm

# Add guidellm bin to PATH
ENV PATH="/opt/app-root/guidellm/bin:$PATH"

# Create a non-root user
RUN useradd -md /results guidellm

# Switch to non-root user
USER guidellm

# Set working directory
WORKDIR /results

# Metadata
LABEL org.opencontainers.image.source="https://github.com/neuralmagic/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_BIN="/opt/app-root/guidellm/bin/guidellm" \
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/app-root/guidellm/bin/entrypoint.sh" ]
4 changes: 2 additions & 2 deletions deploy/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

# Path to the guidellm binary
guidellm_bin="/opt/guidellm/bin/guidellm"
# guidellm executable with default
guidellm_bin="${GUIDELLM_BIN:-/opt/guidellm/bin/guidellm}"

# If we receive any arguments switch to guidellm command
if [ $# -gt 0 ]; then
Expand Down