Refactor image building (e.g. using Buildah instead of Docker) #135
Workflow file for this run
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 and publish Docker images | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- CONTEXT: applications/home-assistant | |
TAG: "2023.5.2" | |
- CONTEXT: applications/oracle-weblogic/12.2.1.3-2018 | |
TAG: "12.2.1.3-2018" | |
- CONTEXT: applications/oracle-weblogic/10.3.6.0-2017 | |
TAG: "10.3.6.0-2017" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.4" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.5" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.6" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.7" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.0" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.1" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.2" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.3" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.4" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "1" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "2" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "2022" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "2023" | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: woody | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: sarge | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: etch | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: lenny | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: squeeze | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: wheezy | |
# - CONTEXT: operating_systems/debian | |
# BASEIMAGE: debian/eol | |
# TAG: jessie | |
# - CONTEXT: operating_systems/debian | |
# TAG: stretch | |
- CONTEXT: operating_systems/debian | |
TAG: buster | |
- CONTEXT: operating_systems/debian | |
TAG: bullseye | |
- CONTEXT: operating_systems/debian | |
TAG: bookworm | |
- CONTEXT: operating_systems/debian | |
TAG: trixie | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.0" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.1" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.2" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.3" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.5" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.9" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.10" | |
- CONTEXT: operating_systems/fedora | |
TAG: "39" | |
- CONTEXT: operating_systems/fedora | |
TAG: "40" | |
- CONTEXT: operating_systems/mageia | |
TAG: "7" | |
- CONTEXT: operating_systems/mageia | |
TAG: "8" | |
- CONTEXT: operating_systems/mageia | |
TAG: "9" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "22.03-lts" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "22.03-lts-sp1" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "22.03-lts-sp2" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "22.03-lts-sp3" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "22.03-lts-sp4" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "23.03" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "23.09" | |
- CONTEXT: operating_systems/openeuler | |
TAG: "24.03-lts" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "5" | |
UPDATED: false | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "6" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "7" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "8" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "9" | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.6" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.7" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.8" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.9" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.1" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.2" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.3" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.4" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.5" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.6" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.7" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi9 | |
TAG: "9.0.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi9 | |
TAG: "9.1.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.5" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.6" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.7" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.8" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.0" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.1" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.2" | |
- CONTEXT: operating_systems/slackware | |
TAG: "13.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: "13.37" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.1" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.2" | |
- CONTEXT: operating_systems/slackware | |
TAG: "15.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: current | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "10.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "12.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "12.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "13.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "13.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "14.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "14.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "15.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "15.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "16.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "16.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "17.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "17.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "18.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "18.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "19.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "19.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "20.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "20.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "21.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "21.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "22.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "22.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "23.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "23.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "24.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "24.10" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Login to Docker Registry | |
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare environment variables | |
run: | | |
echo "IMAGE=ghcr.io/${{ github.repository }}/$(basename ${{ matrix.CONTEXT }}):${{ matrix.TAG }}" >> $GITHUB_ENV | |
echo "BUILD_ARGS<<EOF" >> $GITHUB_ENV | |
echo "TAG=${{ matrix.TAG }}" >> $GITHUB_ENV | |
if [[ -n "${{ matrix.BASEIMAGE }}" ]]; then | |
echo "BASEIMAGE=${{ matrix.BASEIMAGE }}" >> $GITHUB_ENV | |
fi | |
if [[ -n "${{ matrix.UPDATED }}" ]]; then | |
echo "UPDATED=${{ matrix.UPDATED }}" >> $GITHUB_ENV | |
fi | |
echo "EOF" >> $GITHUB_ENV | |
- name: Build Docker image | |
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13 | |
with: | |
context: ${{ matrix.CONTEXT }} | |
tags: ${{ env.IMAGE }} | |
build-args: ${{ env.BUILD_ARGS }} | |
- name: Test Docker image | |
run: | | |
podman run --rm -d --name target -p 2222:22 ${{ env.IMAGE }}:${{ env.TAG }} | |
sshpass -p demo ssh \ | |
-o "StrictHostKeyChecking no" \ | |
-o "KexAlgorithms $(ssh -Q kex | tr '\n' ',' | head -c -1)" \ | |
-o "Ciphers $(ssh -Q ciphers | tr '\n' ',' | head -c -1)" \ | |
-o "HostKeyAlgorithms $(ssh -Q key | tr '\n' ',' | head -c -1)" \ | |
demo@localhost -p 2222 echo "Hello from \$(whoami)@\$(cat /etc/hostname)" | |
podman stop target | |
- name: Publish Docker image | |
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
tags: ${{ env.IMAGE }} |