Skip to content

Add vLLM Docker Github Action #14

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

Merged
merged 19 commits into from
Jul 16, 2025
Merged
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
102 changes: 102 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build & Publish vLLM Docker
on:
push:
branches:
- main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we be able to temporarily enable on: pull_request: just to test this PR out before merging?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

workflow_dispatch:
permissions:
id-token: write
contents: read
concurrency:
group: deployment
cancel-in-progress: false
jobs:
build-and-push:
strategy:
fail-fast: false
runs-on: large_ubuntu_4cpu
timeout-minutes: 360
env:
REGION: us-central1
REPO: vllm
IMAGE: vllm-forked
STAGING_PROJECT: character-ai-staging
PROD_PROJECT: character-ai
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head

- name: Determine tags
id: tags
run: |
SHA=$(git rev-parse --short=7 HEAD)
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "tags=${SHA},latest" >> $GITHUB_OUTPUT

- name: Authenticate to GCP Staging
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER_STAGING }}
service_account: ${{ secrets.GCP_SA_EMAIL_STAGING }}

- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
install_components: "beta"

- name: Configure Docker credential helper for build
run: |
gcloud --quiet auth configure-docker ${{ env.REGION }}-docker.pkg.dev

# Build the image locally first
- name: Build Docker image
run: |
docker build \
-f ./docker/Dockerfile_internal \
--build-arg HF_HOME=/huggingface/cache \
-t local-image:${{ steps.tags.outputs.sha }} \
.

# Tag and push to staging
- name: Tag and Push to Staging
run: |
docker tag local-image:${{ steps.tags.outputs.sha }} ${{ env.REGION }}-docker.pkg.dev/${{ env.STAGING_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker tag local-image:${{ steps.tags.outputs.sha }} ${{ env.REGION }}-docker.pkg.dev/${{ env.STAGING_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:latest

docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.STAGING_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.STAGING_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:latest

# Re-authenticate to prod for prod pushes
- name: Authenticate to GCP Prod
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER_PROD }}
service_account: ${{ secrets.GCP_SA_EMAIL_PROD }}

- name: "Set up Cloud SDK for Prod"
uses: "google-github-actions/setup-gcloud@v2"
with:
install_components: "beta"

- name: Configure Docker credential helper for Prod
run: |
gcloud --quiet auth configure-docker ${{ env.REGION }}-docker.pkg.dev
gcloud --quiet auth configure-docker gcr.io

# Push same image to prod
- name: Push to Prod and GCR
run: |
docker tag local-image:${{ steps.tags.outputs.sha }} ${{ env.REGION }}-docker.pkg.dev/${{ env.PROD_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker tag local-image:${{ steps.tags.outputs.sha }} ${{ env.REGION }}-docker.pkg.dev/${{ env.PROD_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:latest
docker tag local-image:${{ steps.tags.outputs.sha }} gcr.io/${{ env.PROD_PROJECT }}/vllm/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker tag local-image:${{ steps.tags.outputs.sha }} gcr.io/${{ env.PROD_PROJECT }}/vllm/${{ env.IMAGE }}:latest

docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.PROD_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.PROD_PROJECT }}/${{ env.REPO }}/${{ env.IMAGE }}:latest
docker push gcr.io/${{ env.PROD_PROJECT }}/vllm/${{ env.IMAGE }}:${{ steps.tags.outputs.sha }}
docker push gcr.io/${{ env.PROD_PROJECT }}/vllm/${{ env.IMAGE }}:latest
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include requirements/cpu.txt
include CMakeLists.txt

recursive-include cmake *
recursive-include csrc *
recursive-include csrc *
10 changes: 10 additions & 0 deletions docker/Dockerfile_internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM us-central1-docker.pkg.dev/character-ai/vllm/vllm-forked:latest as builder

COPY . /mnt/vllm
RUN pip uninstall -y vllm
RUN VLLM_USE_PRECOMPILED=1 pip install /mnt/vllm
RUN rm -rf /mnt/vllm
RUN python3 -c "import vllm; print('Custom vLLM loaded successfully')"


ENV HF_HOME=/huggingface/cache
Loading