image_build #238
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
# Maintainer: Jonas Strassel <[email protected]> | |
# Description: Builds multi-arch docker images to be used in ci-environments | |
name: image_build | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '30 2 * * 0' | |
env: | |
PLATFORMS: linux/arm64,linux/amd64 | |
jobs: | |
release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
- name: prepare | |
run: | | |
echo "DATE=$(date +%Y%m%d)" >>$GITHUB_ENV | |
- name: setup-qemu | |
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2 | |
- name: setup-buildx | |
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2 | |
- name: login-docker | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: build-docker-base | |
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 | |
with: | |
context: . | |
build-args: | | |
CACHEBUST=${{ env.DATE }} | |
platforms: ${{ env.PLATFORMS }} | |
file: base.Dockerfile | |
push: true | |
tags: manjarolinux/base:${{ env.DATE }},manjarolinux/base:latest | |
cache-from: type=gha, scope=${{ github.workflow }} | |
cache-to: type=gha, scope=${{ github.workflow }} | |
- name: build-docker-build | |
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 | |
with: | |
context: . | |
build-args: | | |
CACHEBUST=${{ env.DATE }} | |
platforms: ${{ env.PLATFORMS }} | |
file: build.Dockerfile | |
push: true | |
tags: manjarolinux/build:${{ env.DATE }},manjarolinux/build:latest | |
cache-from: type=gha, scope=${{ github.workflow }} | |
cache-to: type=gha, scope=${{ github.workflow }} | |
- name: qemu-setup | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu binfmt-support qemu-user-static | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: test-amd64 | |
run: | | |
docker run --rm -t --platform=amd64 manjarolinux/base:latest uname -a | |
docker run --rm -t --platform=amd64 manjarolinux/base:latest pacman --noconfirm -S base-devel | |
docker run --rm -t --platform=amd64 manjarolinux/build:latest uname -a | |
docker run --rm -t --platform=amd64 manjarolinux/build:latest pacman --noconfirm -S python-pip | |
- name: test-arm64 | |
run: | | |
docker run --rm -t --platform=arm64 manjarolinux/base:latest uname -a | |
docker run --rm -t --platform=arm64 manjarolinux/base:latest pacman --noconfirm -S base-devel | |
docker run --rm -t --platform=arm64 manjarolinux/build:latest uname -a | |
docker run --rm -t --platform=arm64 manjarolinux/build:latest pacman --noconfirm -S python-pip |