Docker #1338
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: Docker | |
on: | |
push: | |
branches: [main] | |
tags: [v*.*.*] | |
pull_request: | |
schedule: | |
- cron: 16 9 * * * | |
workflow_dispatch: | |
inputs: | |
targets: | |
description: comma-separated list of container names which should be rebuilt | |
default: "" | |
required: false | |
type: string | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: docker.io | |
ORG: backplane | |
PSUM_LABEL: be.backplane.image.context_psum | |
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 | |
LICENSES: Various Open Source | |
PLATFORMS_OVERRIDE_FILE: .build_platforms.txt | |
LICENSES_OVERRIDE_FILE: LICENSES.txt | |
jobs: | |
image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
strategy: | |
max-parallel: 6 | |
fail-fast: false | |
matrix: | |
container: | |
- 7z | |
- abe | |
- adb | |
- amplify-vueenv | |
- ansible | |
- apg | |
- audiosprite | |
- bind | |
- bpython | |
- cdk-python | |
- chardet | |
- checkmake | |
- chromium | |
- compose_sort | |
- conex-helper | |
- "false" | |
- firefox | |
- ghlatest | |
- goenv | |
- grta | |
- htpasswd | |
- httpie | |
- hugo | |
- jq | |
- json-server | |
- kp1p | |
- lxde | |
- mate | |
- mssql-scripter | |
- myip | |
- ods_conv | |
- pgformatter | |
- proxyport | |
- pwgen | |
- pygmentize | |
- qrencode | |
- shunit2 | |
- snakeeyes | |
- sql-formatter | |
- toybox | |
- "true" | |
- tsqllint | |
- update_requirements | |
- upx | |
- vueenv | |
- wimlib-imagex | |
- wireguard | |
- wpa_passphrase | |
- yamllint | |
- youtube-dl | |
- yq | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# some custom outputs for use later in the build | |
- name: Load Custom Data | |
id: cdata | |
run: | | |
#!/bin/sh | |
set -ex | |
# ensure the required environment variables are set | |
: "${REGISTRY:?}" # this is used in subsequent steps | |
: "${ORG:?}" | |
: "${PSUM_LABEL:?}" | |
# generate some outputs about the container being built | |
docker run \ | |
--rm \ | |
--pull "always" \ | |
--user "$(id -u)" \ | |
--env "GITHUB_OUTPUT" \ | |
--volume "$(pwd):/work" \ | |
--volume "/home/runner:/home/runner" \ | |
backplane/conex-helper \ | |
metadata \ | |
--forcedbuilds '${{ github.event.inputs.force_build }}' \ | |
'${{ matrix.container }}' | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
uses: docker/setup-buildx-action@v3 | |
# https://github.com/docker/login-action | |
- name: Login to Docker Hub | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.container }} | |
tags: | | |
type=raw,value=latest | |
flavor: | | |
latest=false | |
labels: | | |
org.opencontainers.image.title=${{ matrix.container }} | |
org.opencontainers.image.source=https://github.com/backplane/conex/tree/main/${{ matrix.container }} | |
org.opencontainers.image.licenses=${{ steps.cdata.outputs.licenses }} | |
org.opencontainers.image.description=${{ steps.cdata.outputs.description }} | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.container }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: | | |
${{ steps.meta.outputs.labels }} | |
${{ env.PSUM_LABEL }}=${{ steps.cdata.outputs.psum }} | |
platforms: ${{ steps.cdata.outputs.platforms }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# https://github.com/peter-evans/dockerhub-description | |
- name: Update Docker Hub Description | |
if: ${{ steps.cdata.outputs.skipbuild != '1' }} | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: ${{ env.ORG }}/${{ matrix.container }} | |
short-description: ${{ steps.cdata.outputs.description }} | |
readme-filepath: ${{ matrix.container }}/README.md |