diff --git a/.gitea/workflows/build-gb10.yml b/.gitea/workflows/build-gb10.yml new file mode 100644 index 00000000000..945fca4d1eb --- /dev/null +++ b/.gitea/workflows/build-gb10.yml @@ -0,0 +1,105 @@ +name: Build GB10 ARM64 image + +on: + workflow_dispatch: + push: + branches: + - karylab/gb10 + paths: + - ".gitea/workflows/build-gb10.yml" + - "CMakeLists.txt" + - "cmake/**" + - "csrc/**" + - "docker/**" + - "pyproject.toml" + - "requirements/**" + - "setup.py" + - "vllm/**" + +env: + REGISTRY: git.karylab.com + IMAGE_NAME: karylab_agents/vllm-gb10 + +jobs: + build-arm64: + # This label is registered by gitea-act-runner.yml. + runs-on: vllm-x86-builder + timeout-minutes: 720 + + # Do not add pull_request as a trigger. This runner controls the build + # host's Docker socket and must only execute reviewed code on main. + permissions: + contents: read + + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Enable ARM64 emulation + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Create Buildx builder + uses: docker/setup-buildx-action@v3 + + - name: Validate registry credential + env: + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + if [ -z "${REGISTRY_TOKEN}" ]; then + echo "Missing repository Actions secret: REGISTRY_TOKEN" >&2 + exit 1 + fi + + - name: Log in to Gitea Container Registry + env: + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + printf '%s' "${REGISTRY_TOKEN}" | + docker login "${REGISTRY}" \ + --username karylab_agents \ + --password-stdin + + - name: Derive immutable image tag + id: image + shell: bash + run: | + short_sha="$(git rev-parse --short=12 HEAD)" + echo "tag=gb10-${short_sha}" >> "${GITHUB_OUTPUT}" + echo "revision=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}" + + - name: Build and push ARM64 image + env: + IMAGE_TAG: ${{ steps.image.outputs.tag }} + REVISION: ${{ steps.image.outputs.revision }} + run: | + image="${REGISTRY}/${IMAGE_NAME}" + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + + docker buildx build \ + --platform linux/arm64 \ + --file docker/Dockerfile \ + --target vllm-openai \ + --build-arg "torch_cuda_arch_list=12.0" \ + --build-arg "max_jobs=4" \ + --build-arg "nvcc_threads=8" \ + --build-arg "VLLM_BUILD_COMMIT=${REVISION}" \ + --build-arg "VLLM_BUILD_PIPELINE=gitea-actions" \ + --build-arg "VLLM_BUILD_URL=${run_url}" \ + --build-arg "VLLM_IMAGE_TAG=${image}:${IMAGE_TAG}" \ + --cache-from "type=registry,ref=${image}:buildcache" \ + --cache-to "type=registry,ref=${image}:buildcache,mode=max,compression=zstd,oci-mediatypes=true" \ + --label "org.opencontainers.image.revision=${REVISION}" \ + --label "org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}" \ + --tag "${image}:${IMAGE_TAG}" \ + --tag "${image}:latest" \ + --push \ + . + + - name: Verify published image + env: + IMAGE_TAG: ${{ steps.image.outputs.tag }} + run: | + docker buildx imagetools inspect \ + "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"