Skip to content

[Recognizer] Add docker image #4

[Recognizer] Add docker image

[Recognizer] Add docker image #4

name: Build and publish Docker image
on:
workflow_call:
inputs:
app-name:
required: true
type: string
platform:
required: true
type: string
runner:
required: true
type: string
push:
paths:
- 'recognizer/**'
env:
REGISTRY: ghcr.io
jobs:
build-and-push-image:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ inputs.app-name }}
tags: |
type=match,pattern=${{ inputs.app-name }}-v(\d.\d.\d)
type=edge,branch=reco-docker
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./${{ inputs.app-name }}
platforms: ${{ inputs.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max