Skip to content

Commit

Permalink
Add GitHub actions workflow for building container images
Browse files Browse the repository at this point in the history
  • Loading branch information
mtneug committed Aug 20, 2024
1 parent 9b9ea94 commit a743051
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/container-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: container-images

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- main

jobs:
build-and-push-images:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
matrix:
image:
- ingest

env:
IMAGE_PLATFORMS: linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x

steps:
- uses: actions/checkout@v4

- name: set up Docker
uses: crazy-max/ghaction-setup-docker@v3
with:
# containerd image store allows to load multi-platform images
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- uses: docker/login-action@v3
if: ${{ github.event_name == 'push' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: set up Docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.IMAGE_PLATFORMS }}

- name: info
id: info
run: |
VERSION=dev
if [ "${{ github.ref_type }}" = 'tag' ]; then
VERSION="${{ github.ref_name }}"
fi
echo "VERSION=${VERSION}" | tee -a "$GITHUB_OUTPUT"
- name: build and push container images
run: |
case "${{ github.event_name }}" in
push) BUILDX_OUTPUT='--push' ;;
*) BUILDX_OUTPUT='--load' ;;
esac
make image-${{ matrix.image }} \
VERSION=${{ steps.info.outputs.VERSION }} \
IMAGE_PLATFORMS=${{ env.IMAGE_PLATFORMS }} \
BUILDX_OUTPUT="${BUILDX_OUTPUT}"

0 comments on commit a743051

Please sign in to comment.