|
| 1 | +# TODO: Update to official python-3.13-minimal image when available |
| 2 | +ARG BASE_IMAGE=quay.io/fedora/python-313-minimal:latest |
| 3 | + |
| 4 | +# release: take the last version and add a post if build iteration |
| 5 | +# candidate: increment to next minor, add 'rc' with build iteration |
| 6 | +# nightly: increment to next minor, add 'a' with build iteration |
| 7 | +# alpha: increment to next minor, add 'a' with build iteration |
| 8 | +# dev: increment to next minor, add 'dev' with build iteration |
| 9 | +ARG GUIDELLM_BUILD_TYPE=dev |
| 10 | + |
| 11 | +# Use a multi-stage build to create a lightweight production image |
| 12 | +FROM $BASE_IMAGE as builder |
| 13 | + |
| 14 | +# Switch to root for installing packages |
| 15 | +USER root |
| 16 | + |
| 17 | +# Install build tooling |
| 18 | +RUN dnf install -y git \ |
| 19 | + && /usr/bin/python3 -m venv /tmp/pdm \ |
| 20 | + && /tmp/pdm/bin/pip install --no-cache-dir -U pdm \ |
| 21 | + && ln -s /tmp/pdm/bin/pdm /usr/local/bin/pdm |
| 22 | + |
| 23 | +# Disable pdm update check |
| 24 | +# Set correct build type for versioning |
| 25 | +ENV PDM_CHECK_UPDATE=false \ |
| 26 | + GUIDELLM_BUILD_TYPE=$GUIDELLM_BUILD_TYPE |
| 27 | + |
| 28 | +# Copy repository files |
| 29 | +# Do this as late as possible to leverage layer caching |
| 30 | +COPY / /src |
| 31 | + |
| 32 | +# Install guidellm and locked dependencies |
| 33 | +RUN pdm use -p /src -f /opt/app-root \ |
| 34 | + && pdm install -p /src --check --prod --no-editable |
| 35 | + |
| 36 | +# Prod image |
| 37 | +FROM $BASE_IMAGE |
| 38 | + |
| 39 | +# Add guidellm bin to PATH |
| 40 | +# Argument defaults can be set with GUIDELLM_<ARG> |
| 41 | +ENV HOME="/home/guidellm" \ |
| 42 | + GUIDELLM_OUTPUT_PATH="/results/benchmarks.json" |
| 43 | + |
| 44 | +# Make sure root is the primary group |
| 45 | +USER 1001:0 |
| 46 | + |
| 47 | +# Create the user home dir |
| 48 | +WORKDIR $HOME |
| 49 | + |
| 50 | +# Create a volume for results |
| 51 | +VOLUME /results |
| 52 | + |
| 53 | +# Metadata |
| 54 | +LABEL io.k8s.display-name="GuideLLM" \ |
| 55 | + org.opencontainers.image.description="GuideLLM Performance Benchmarking Container" \ |
| 56 | + org.opencontainers.image.source="https://github.com/vllm-project/guidellm" \ |
| 57 | + org.opencontainers.image.documentation="https://blog.vllm.ai/guidellm/stable" \ |
| 58 | + org.opencontainers.image.license="Apache-2.0" |
| 59 | + |
| 60 | +# Copy the virtual environment from the builder stage |
| 61 | +# Do this as late as possible to leverage layer caching |
| 62 | +COPY --chown=1001:0 --from=builder /opt/app-root /opt/app-root |
| 63 | + |
| 64 | +ENTRYPOINT [ "/opt/app-root/bin/guidellm" ] |
| 65 | +CMD [ "benchmark", "run" ] |
0 commit comments