Skip to content

Build and push docker image to Github registry #3

Build and push docker image to Github registry

Build and push docker image to Github registry #3

name: Build and push docker image to Github registry
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the Docker image:'
required: true
jobs:
build-and-push:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
runs-on: ubuntu-latest
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@v4
- name: Initialize Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
config-inline: |
[registry."docker.io"]
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.3.0
with:
flavor: |
latest=true
images: ghcr.io/huggingface/tei-gaudi
tags: |
type=raw,value=${{ github.event.inputs.tag }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-hpu
push: true
platforms: 'linux/amd64'
tags: ${{ steps.meta.outputs.tags }}