2022-09-01 18:51:23 +00:00
|
|
|
name: Build Containers
|
|
|
|
|
|
|
|
# Controls when the workflow will run
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
- "v*.*.*"
|
|
|
|
paths:
|
2023-12-28 20:19:18 +00:00
|
|
|
- "image/**"
|
2022-09-01 18:51:23 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-12-28 20:19:18 +00:00
|
|
|
# Get the repository's code
|
2022-09-01 18:51:23 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# https://github.com/docker/setup-qemu-action
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
# https://github.com/docker/setup-buildx-action
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to the Container registry
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
# generate Docker tags based on the following events/attributes
|
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
|
|
|
flavor: |
|
|
|
|
latest=true
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2023-12-28 20:19:18 +00:00
|
|
|
context: image/.
|
2022-09-01 18:51:23 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|