2022-12-06 12:28:07 +00:00
|
|
|
name: Build and push cloud image
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- v*
|
2022-12-07 13:03:33 +00:00
|
|
|
# we will NOT push the image on pull requests, only test buildability.
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-12-06 12:28:07 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
arch:
|
|
|
|
- x86_64
|
2022-12-07 13:03:33 +00:00
|
|
|
# requires resolving a patchmatch issue
|
|
|
|
# - aarch64
|
2022-12-06 12:28:07 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: ${{ matrix.arch }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2022-12-07 13:03:33 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
if: matrix.arch == 'aarch64'
|
|
|
|
|
2022-12-06 12:28:07 +00:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2022-12-07 13:03:33 +00:00
|
|
|
# see https://github.com/docker/metadata-action
|
|
|
|
# will push the following tags:
|
|
|
|
# :edge
|
|
|
|
# :main (+ any other branches enabled in the workflow)
|
|
|
|
# :<tag>
|
|
|
|
# :1.2.3 (for semver tags)
|
|
|
|
# :1.2 (for semver tags)
|
|
|
|
# :<sha>
|
2022-12-06 12:28:07 +00:00
|
|
|
tags: |
|
2022-12-07 13:03:33 +00:00
|
|
|
type=edge,branch=main
|
2022-12-06 12:28:07 +00:00
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
2022-12-07 13:03:33 +00:00
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
2022-12-06 12:28:07 +00:00
|
|
|
type=sha
|
2022-12-07 13:03:33 +00:00
|
|
|
# suffix image tags with architecture
|
|
|
|
flavor: |
|
|
|
|
latest=auto
|
|
|
|
suffix=-${{ matrix.arch }},latest=true
|
2022-12-06 12:28:07 +00:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
2022-12-07 13:03:33 +00:00
|
|
|
# do not login to container registry on PRs
|
|
|
|
- if: github.event_name != 'pull_request'
|
|
|
|
name: Docker login
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-12-06 12:28:07 +00:00
|
|
|
|
|
|
|
- name: Build and push cloud image
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker-build/Dockerfile.cloud
|
|
|
|
platforms: Linux/${{ matrix.arch }}
|
2022-12-07 13:03:33 +00:00
|
|
|
# do not push the image on PRs
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2022-12-06 12:28:07 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2022-12-06 17:06:48 +00:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|