1- ARG BASE_IMAGE=docker.io/python:3.13-slim
1+ # FIXME: Update to official python-3.13-minimal image when available
2+ ARG BASE_IMAGE=quay.io/psap/python-313-minimal:fedora
23
34# release: take the last version and add a post if build iteration
45# candidate: increment to next minor, add 'rc' with build iteration
@@ -10,13 +11,14 @@ ARG GUIDELLM_BUILD_TYPE=dev
1011# Use a multi-stage build to create a lightweight production image
1112FROM $BASE_IMAGE as builder
1213
13- # Ensure files are installed as root
14+ # Switch to root for installing packages
1415USER root
1516
1617# Install build tooling
17- RUN apt-get update \
18- && apt-get install -y --no-install-recommends git \
19- && pip install --no-cache-dir -U pdm
18+ RUN dnf install -y git \
19+ && 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
2022
2123# Disable pdm update check
2224# Set correct build type for versioning
@@ -28,8 +30,7 @@ ENV PDM_CHECK_UPDATE=false \
2830COPY / /opt/app-root/src
2931
3032# Create a venv and install guidellm
31- RUN python3 -m venv /opt/app-root/guidellm \
32- && pdm use -p /opt/app-root/src -f /opt/app-root/guidellm \
33+ RUN pdm use -p /opt/app-root/src -f /opt/app-root \
3334 && pdm install -p /opt/app-root/src --check --prod --no-editable
3435
3536# Prod image
@@ -38,14 +39,10 @@ FROM $BASE_IMAGE
3839# Add guidellm bin to PATH
3940# Argument defaults can be set with GUIDELLM_<ARG>
4041ENV HOME="/home/guidellm" \
41- PATH="/opt/app-root/guidellm/bin:$PATH" \
4242 GUIDELLM_OUTPUT_PATH="/results/benchmarks.json"
4343
44- # Create a non-root user
45- RUN useradd -K UMASK=0002 -Md $HOME -g root guidellm
46-
47- # Switch to non-root user
48- USER guidellm
44+ # Make sure root is the primary group
45+ USER 1001:0
4946
5047# Create the user home dir
5148WORKDIR $HOME
@@ -59,7 +56,7 @@ LABEL org.opencontainers.image.source="https://github.com/vllm-project/guidellm"
5956
6057# Copy the virtual environment from the builder stage
6158# Do this as late as possible to leverage layer caching
62- COPY --from=builder /opt/app-root/guidellm /opt/app-root/guidellm
59+ COPY --chown=1001:0 -- from=builder /opt/app-root /opt/app-root
6360
64- ENTRYPOINT [ "/opt/app-root/guidellm/ bin/guidellm" ]
61+ ENTRYPOINT [ "/opt/app-root/bin/guidellm" ]
6562CMD [ "benchmark" , "run" ]
0 commit comments