-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Build and push AMD ROCm docker image to registry | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
paths: | ||
- ".github/workflows/build.yaml" | ||
# - "integration-tests/**" | ||
- "backends/**" | ||
- "core/**" | ||
- "router/**" | ||
- "Cargo.lock" | ||
- "rust-toolchain.toml" | ||
- "Dockerfile" | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build-and-push-image: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.job }}-rocm-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
runs-on: [self-hosted, intel-cpu, 32-cpu, 256-ram, ci] | ||
permissions: | ||
contents: write | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
security-events: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Initialize Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
- name: Configure sccache | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | ||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
- name: Tailscale | ||
uses: huggingface/tailscale-action@v1 | ||
with: | ||
authkey: ${{ secrets.TAILSCALE_AUTHKEY }} | ||
- name: Login to GitHub Container Registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to internal Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.TAILSCALE_DOCKER_USERNAME }} | ||
password: ${{ secrets.TAILSCALE_DOCKER_PASSWORD }} | ||
registry: registry.internal.huggingface.tech | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta-rocm | ||
uses: docker/[email protected] | ||
with: | ||
images: | | ||
registry.internal.huggingface.tech/api-inference/text-embeddings-inference | ||
ghcr.io/huggingface/text-embeddings-inference | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=semver,pattern=rocm-{{version}} | ||
type=semver,pattern=rocm-{{major}}.{{minor}} | ||
type=raw,value=rocm-latest | ||
type=raw,value=rocm-sha-${{ env.GITHUB_SHA_SHORT }} | ||
- name: Build and push Docker image | ||
id: build-and-push-rocm | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile-cuda | ||
push: ${{ github.event_name != 'pull_request' }} | ||
platforms: 'linux/amd64' | ||
build-args: | | ||
SCCACHE_GHA_ENABLED=on | ||
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} | ||
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} | ||
GIT_SHA=${{ env.GITHUB_SHA }} | ||
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }} | ||
tags: ${{ steps.meta-rocm.outputs.tags }} | ||
labels: ${{ steps.meta-rocm.outputs.labels }} | ||
cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-rocm,mode=max | ||
cache-to: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-rocm,mode=max | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta-rocm-grpc | ||
uses: docker/[email protected] | ||
with: | ||
images: | | ||
registry.internal.huggingface.tech/api-inference/text-embeddings-inference | ||
ghcr.io/huggingface/text-embeddings-inference | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=semver,pattern=rocm-{{version}}-grpc | ||
type=semver,pattern=rocm-{{major}}.{{minor}}-grpc | ||
type=raw,value=rocm-latest-grpc | ||
type=raw,value=rocm-sha-${{ env.GITHUB_SHA_SHORT }}-grpc | ||
- name: Build and push Docker image | ||
id: build-and-push-rocm-grpc | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: grpc | ||
file: Dockerfile-cuda | ||
push: ${{ github.event_name != 'pull_request' }} | ||
platforms: 'linux/amd64' | ||
build-args: | | ||
SCCACHE_GHA_ENABLED=on | ||
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} | ||
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} | ||
GIT_SHA=${{ env.GITHUB_SHA }} | ||
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }} | ||
tags: ${{ steps.meta-rocm-grpc.outputs.tags }} | ||
labels: ${{ steps.meta-rocm-grpc.outputs.labels }} | ||
cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-rocm,mode=max |