Skip to content

Commit 59c1be8

Browse files
authored
Various fixes to container image and CI (#254)
## Summary <!-- Include a short paragraph of the changes introduced in this PR. If this PR requires additional context or rationale, explain why the changes are necessary. --> Various fixes to containers images and CI. Containers images should now reuse most layers on build, need less hacks when running in OCP, and properly detect the guidellm version. Release and RC git tags/branches tag the container image with the version. The `latest` and `stable` tags now smartly update based on highest version tag (prev most recent build). ## Details <!-- Provide a detailed list of all changes introduced in this pull request. --> - Moves Containerfile to top-level - Adds a `.containerignore` that mirrors `.gitignore` - Fixes version detection in image builds - Correctly sets release type and tags rc/release with version when building images - Use PDM to lock venv in image builds - Adds weekly job for tagging latest and stable based on existing version tagged images - Adds weekly job to prune dev containers that are more than 2 weeks old - Note: This job is currently set to dry-run and will be enabled in a future PR - Improves container compatibility with K8s unpriv users - Reorders image layers to improve build caching ## Test Plan <!-- List the steps needed to test this PR. --> ### 1. Workflows - Workflows were partially tested with [act](https://github.com/nektos/act) but need to be run on GitHub to verify ### 2. Container Changes 1. Run `podman run --rm ghcr.io/vllm-project/guidellm:pr-254 --version` to verify version is set 2. Run `podman run --rm --entrypoint /opt/app-root/guidellm/bin/pip ghcr.io/vllm-project/guidellm:pr-254 freeze` and verify that versions match the `pylock.toml`. 3. Run a pod with the GuideLLM container and verify the user has write permissions to `/home/guidellm`. (For tokenizer/dataset caching) ## Related Issues <!-- Link any relevant issues that this PR addresses. --> - Resolves # --- - [x] "I certify that all code in this PR is my own, except as noted below." ## Use of AI - [ ] Includes AI-assisted code completion - [ ] Includes code generated by an AI application - [ ] Includes AI-generated tests (NOTE: AI written tests should have a docstring that includes `## WRITTEN BY AI ##`) --------- Signed-off-by: Samuel Monson <[email protected]>
1 parent a4bdbb5 commit 59c1be8

File tree

9 files changed

+150
-50
lines changed

9 files changed

+150
-50
lines changed

.containerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Container Image Maintenance
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * 3' # Runs at 2am on Wednesdays
6+
workflow_dispatch: # Enables manual triggering of the workflow
7+
8+
# Only run one at a time
9+
concurrency:
10+
group: ${{ github.workflow }}
11+
12+
jobs:
13+
cleanup-container-tags:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Delete PR and untagged images older than 2 weeks
17+
uses: snok/[email protected]
18+
with:
19+
account: ${{ github.actor }}
20+
token: ${{ github.token }}
21+
image-names: ${{ github.event.repository.name }}
22+
image-tags: "pr-*"
23+
cut-off: 2w
24+
dry-run: true
25+
26+
push-container-tags:
27+
runs-on: ubuntu-latest
28+
needs: cleanup-container-tags
29+
if: always() # Run after cleanup even if it fails
30+
steps:
31+
- name: Log into ghcr.io
32+
uses: redhat-actions/podman-login@v1
33+
with:
34+
username: ${{ github.actor }}
35+
password: ${{ github.token }}
36+
registry: ghcr.io/${{ github.repository_owner }}
37+
- name: Get list of tags
38+
run: |
39+
skopeo list-tags docker://${{ github.repository }} | jq --raw-output '.Tags[]' > tags
40+
- name: Get latest release and rc tags
41+
run: |
42+
STABLE_TAG="$(grep -P '^v\d+\.\d+\.\d+$' tags | sort -rV | head -n1)"
43+
echo "STABLE_TAG=${STABLE_TAG:-v0.0.0}" >> $GITHUB_ENV
44+
LATEST_TAG="$(grep -P '^v\d+\.\d+\.\d+' tags | sort -rV | head -n1)"
45+
echo "LATEST_TAG=${LATEST_TAG:-v0.0.0}" >> $GITHUB_ENV
46+
- name: Update latest and stable tags
47+
run: |
48+
skopeo copy docker://${{ github.repository }}:${{ env.stable_tag }} docker://${{ github.repository }}:stable
49+
skopeo copy docker://${{ github.repository }}:${{ env.latest_tag }} docker://${{ github.repository }}:latest

.github/workflows/development.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,18 @@ jobs:
293293
steps:
294294
- name: Checkout
295295
uses: actions/checkout@v4
296+
with:
297+
fetch-depth: 0
296298
- name: Buildah build
297299
id: build-image
298300
uses: redhat-actions/buildah-build@v2
299301
with:
300302
image: ${{ github.event.repository.name }}
303+
build-args: |
304+
GUIDELLM_BUILD_TYPE=dev
301305
tags: "pr-${{ github.event.number }}"
302306
containerfiles: |
303-
./deploy/Containerfile
307+
./Containerfile
304308
- name: Push To ghcr.io
305309
id: push-to-ghcr
306310
uses: redhat-actions/push-to-registry@v2

.github/workflows/nightly.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,18 @@ jobs:
251251
steps:
252252
- name: Checkout
253253
uses: actions/checkout@v4
254+
with:
255+
fetch-depth: 0
254256
- name: Buildah build
255257
id: build-image
256258
uses: redhat-actions/buildah-build@v2
257259
with:
258260
image: ${{ github.event.repository.name }}
261+
build-args: |
262+
GUIDELLM_BUILD_TYPE=nightly
259263
tags: nightly
260264
containerfiles: |
261-
./deploy/Containerfile
265+
./Containerfile
262266
- name: Push To ghcr.io
263267
id: push-to-ghcr
264268
uses: redhat-actions/push-to-registry@v2

.github/workflows/release-candidate.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,20 @@ jobs:
295295
steps:
296296
- name: Checkout
297297
uses: actions/checkout@v4
298+
with:
299+
fetch-depth: 0
300+
- name: Get version from branch
301+
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
298302
- name: Buildah build
299303
id: build-image
300304
uses: redhat-actions/buildah-build@v2
301305
with:
302306
image: ${{ github.event.repository.name }}
303-
# TODO: Tag version
304-
tags: latest
307+
build-args: |
308+
GUIDELLM_BUILD_TYPE=candidate
309+
tags: ${{ env.package_version }}~rc
305310
containerfiles: |
306-
./deploy/Containerfile
311+
./Containerfile
307312
- name: Push To ghcr.io
308313
id: push-to-ghcr
309314
uses: redhat-actions/push-to-registry@v2

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,20 @@ jobs:
294294
steps:
295295
- name: Checkout
296296
uses: actions/checkout@v4
297+
with:
298+
fetch-depth: 0
299+
- name: Get version from branch
300+
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
297301
- name: Buildah build
298302
id: build-image
299303
uses: redhat-actions/buildah-build@v2
300304
with:
301305
image: ${{ github.event.repository.name }}
302-
# TODO: Tag version
303-
tags: latest stable
306+
build-args: |
307+
GUIDELLM_BUILD_TYPE=release
308+
tags: ${{ env.package_version }}
304309
containerfiles: |
305-
./deploy/Containerfile
310+
./Containerfile
306311
- name: Push To ghcr.io
307312
id: push-to-ghcr
308313
uses: redhat-actions/push-to-registry@v2

Containerfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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" ]

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ podman run \
7171
7272
Replace `latest` with `stable` for the newest tagged release or set a specific release if desired.
7373

74+
#### Available Tags
75+
76+
| Tags | Notes |
77+
| ------------------------------------------------------------------------------------------ | --------------------------------------------- |
78+
| `nightly` | Built from `main` every night |
79+
| [`v0.3.0`](https://github.com/vllm-project/guidellm/releases/tag/v0.3.0) `stable` `latest` | - |
80+
| [`v0.2.1`](https://github.com/vllm-project/guidellm/releases/tag/v0.2.1) | - |
81+
| `pr-*` | Development builds (DO NOT USE IN PRODUCTION) |
82+
7483
### Quick Start
7584

7685
#### 1. Start an OpenAI Compatible Server (vLLM)

deploy/Containerfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)