Build Container Images #190
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 Container Images | |
on: | |
schedule: | |
- cron: '33 4 * * 0' | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
name: Build ${{ matrix.cfg.base }} Image | |
strategy: | |
matrix: | |
cfg: | |
- base: core | |
base_os: xenial | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/ppc64le | |
- base: core18 | |
base_os: bionic | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/ppc64le #,linux/s390x | |
- base: core20 | |
base_os: focal | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le #,linux/s390x | |
- base: core22 | |
base_os: jammy | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le #,linux/s390x | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: diddledani/snapcraft | |
tags: | | |
type=ref,event=branch,prefix=${{ matrix.cfg.base }}- | |
type=ref,event=pr,prefix=${{ matrix.cfg.base }}- | |
type=semver,pattern={{version}},prefix=${{ matrix.cfg.base }}- | |
type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.cfg.base }}- | |
type=sha,prefix=${{ matrix.cfg.base }}- | |
type=raw,value=${{ matrix.cfg.base }} | |
labels: | | |
org.opencontainers.image.title=Snapcraft for ${{ matrix.cfg.base }} builds | |
org.opencontainers.image.description=Image of Snapcraft for building projects targeting the ${{ matrix.cfg.base }} base snap. | |
[email protected] | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ matrix.cfg.platforms }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
BASE_OS=${{ matrix.cfg.base_os }} |