fix: percentiles #15
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
name: Build and push docker image to internal registry | |
on: | |
workflow_call: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- "main" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-push: | |
runs-on: | |
group: aws-general-8-plus-priv | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Initialize Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
buildkitd-config: /tmp/buildkitd.toml | |
- name: Login to internal Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
registry: registry.internal.huggingface.tech | |
# If pull request | |
- name: Extract metadata (tags, labels) for Docker | |
if: ${{ github.event_name == 'pull_request' }} | |
id: meta-pr | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
registry.internal.huggingface.tech/api-inference/text-generation-inference-benchmark | |
tags: | | |
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} | |
# If main, release or tag | |
- name: Extract metadata (tags, labels) for Docker | |
if: ${{ github.event_name != 'pull_request' }} | |
id: meta | |
uses: docker/[email protected] | |
with: | |
flavor: | | |
latest=auto | |
images: | | |
registry.internal.huggingface.tech/api-inference/text-generation-inference-benchmark | |
tags: | | |
type=semver,pattern={{version}}${{ env.LABEL }} | |
type=semver,pattern={{major}}.{{minor}}${{ env.LABEL }} | |
type=raw,value=latest${{ env.LABEL }},enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE }} | |
push: true | |
platforms: 'linux/amd64' | |
build-args: | | |
GIT_SHA=${{ env.GITHUB_SHA }} | |
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} | |
PLATFORM=${{ env.PLATFORM }} | |
tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} |