Containerize the segmenter #25
Workflow file for this run
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 Docker container image for the segmenter | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'beta' | |
- 'stable' | |
tags: | |
- 'documentation/v*' | |
pull_request: | |
merge_group: | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: 'Git ref (optional)' | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Build and publish Docker container image | |
- name: Get Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/planktoscope/backend-processing-segmenter | |
tags: | | |
type=match,pattern=v(.*),group=1 | |
type=edge,branch=main | |
type=ref,event=branch,enable=${{ github.ref != format('refs/heads/{0}', 'main') && github.ref != format('refs/heads/{0}', 'main') }} | |
type=ref,event=pr | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} | |
type=sha | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'push tag' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./processing/segmenter | |
pull: true | |
push: ${{ github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'push tag' }} | |
platforms: linux/arm/v7 #,linux/amd64,linux/arm64,linux/arm/v7 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |