2506: Finishing touches for fixing arm builds r=mergify[bot] a=Diman0

- Use self-hosted runners for arm base image
- Use seperate docker image cache for arm build

## What type of PR?

fix

## What does this PR do?

### Related issue(s)
n/a

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [n/a] In case of feature or enhancement: documentation updated accordingly
- [n/a] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Dimitri Huisman <diman@huisman.xyz>
main
bors[bot] 2 years ago committed by GitHub
commit 4d8585a3fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -89,9 +89,10 @@ jobs:
run: | run: |
echo ${{ steps.targets.outputs.matrix }} echo ${{ steps.targets.outputs.matrix }}
## This job buils the base image. The base image is used by all other images. ## This job builds the base image. The base image is used by all other images.
build-base-image: build-base-image-x64:
name: Build base image name: Build base image
if: inputs.architecture == 'linux/amd64'
needs: needs:
- targets - targets
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -139,6 +140,57 @@ jobs:
*.cache-to=type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/base:${{ hashFiles('core/base/Dockerfile','core/base/requirements-prod.txt') }},mode=max *.cache-to=type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/base:${{ hashFiles('core/base/Dockerfile','core/base/requirements-prod.txt') }},mode=max
*.platform=${{ inputs.architecture }} *.platform=${{ inputs.architecture }}
## This job builds the base image. The base image is used by all other images.
build-base-image-arm:
name: Build base image
if: inputs.architecture != 'linux/amd64'
needs:
- targets
runs-on: self-hosted
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Retrieve global variables
shell: bash
run: |
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: crazy-max/ghaction-github-runtime@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Helper to convert docker org to lowercase
id: string
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.repository_owner }}
- name: Build all docker images
env:
DOCKER_ORG: ghcr.io/${{ steps.string.outputs.lowercase }}
MAILU_VERSION: ${{ env.MAILU_VERSION }}
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
uses: docker/bake-action@v2
with:
files: ${{env.HCL_FILE}}
targets: base
load: false
push: false
set: |
*.cache-from=type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/base:${{ hashFiles('core/base/Dockerfile','core/base/requirements-prod.txt') }}-arm
*.cache-to=type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/base:${{ hashFiles('core/base/Dockerfile','core/base/requirements-prod.txt') }}-arm,mode=max
*.platform=${{ inputs.architecture }}
# This job builds all the images. The build cache is stored in the github actions cache. # This job builds all the images. The build cache is stored in the github actions cache.
# In further jobs, this cache is used to quickly rebuild the images. # In further jobs, this cache is used to quickly rebuild the images.
build: build:
@ -146,7 +198,7 @@ jobs:
if: inputs.architecture == 'linux/amd64' if: inputs.architecture == 'linux/amd64'
needs: needs:
- targets - targets
- build-base-image - build-base-image-x64
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -204,7 +256,7 @@ jobs:
if: inputs.architecture != 'linux/amd64' if: inputs.architecture != 'linux/amd64'
needs: needs:
- targets - targets
- build-base-image - build-base-image-arm
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -264,7 +316,6 @@ jobs:
contents: read contents: read
packages: read packages: read
needs: needs:
- targets
- build - build
strategy: strategy:
fail-fast: false fail-fast: false
@ -319,7 +370,6 @@ jobs:
if: inputs.deploy == 'true' if: inputs.deploy == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- build
- tests - tests
strategy: strategy:
fail-fast: false fail-fast: false

Loading…
Cancel
Save