add sudo
to all containers, so it can be used to run commands with non-root user via 'sudo -u easybuild ...'
#90
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 container images | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build_publish: | |
name: Build/publish | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
platform: [amd64, arm64] | |
tag: | |
- centos-7.9-python3 | |
- centos-7.9 | |
- centos-8.5 | |
- centosstream-9 | |
- fedora-35 | |
- fedora-36 | |
- opensuse-15.3 | |
- opensuse-15.4 | |
- rockylinux-8.5 | |
- rockylinux-8.6 | |
- rockylinux-8.7 | |
- rockylinux-9.0 | |
- rockylinux-9.1 | |
- almalinux-8.6 | |
- almalinux-9.0 | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
fail-fast: false | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.tag }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.tag }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Convert and store repository owner in lowercase | |
run: | | |
echo REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
echo DOCKERFILE=${{ matrix.tag }}/Dockerfile >> $GITHUB_ENV | |
- name: Build and push to GitHub Packages | |
uses: docker/build-push-action@v3 | |
with: | |
tags: ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ matrix.tag }}-${{ matrix.platform }} | |
file: ${{ env.DOCKERFILE }} | |
platforms: linux/${{ matrix.platform }} | |
push: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
docker_manifest: | |
name: Docker manifest | |
needs: build_publish | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
tag: | |
- centos-7.9-python3 | |
- centos-7.9 | |
- centos-8.5 | |
- centosstream-9 | |
- fedora-35 | |
- fedora-36 | |
- opensuse-15.3 | |
- opensuse-15.4 | |
- rockylinux-8.5 | |
- rockylinux-8.6 | |
- rockylinux-8.7 | |
- rockylinux-9.0 | |
- rockylinux-9.1 | |
- almalinux-8.6 | |
- almalinux-9.0 | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
steps: | |
- name: Login to GitHub Container Registry | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Convert and store repository owner in lowercase | |
run: | | |
echo REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: Run docker manifest | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: | | |
docker manifest create \ | |
ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ matrix.tag }} \ | |
ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ matrix.tag }}-amd64 \ | |
ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ matrix.tag }}-arm64 | |
- name: Push manifest | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: docker manifest push ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ matrix.tag }} |