From f36cc29af2a84757794a230af00fdd2965f04617 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 22 Feb 2023 01:26:28 -0800 Subject: [PATCH 1/2] Adding new workflow to build builder image --- .github/workflows/buildBuilderImage.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/buildBuilderImage.yml diff --git a/.github/workflows/buildBuilderImage.yml b/.github/workflows/buildBuilderImage.yml new file mode 100644 index 0000000..e69de29 From fcdc180254b68b499bb31ea52418d6e5c163164c Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 22 Feb 2023 01:27:58 -0800 Subject: [PATCH 2/2] First-pass buildBuilderImage.yml --- .github/workflows/buildBuilderImage.yml | 93 +++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/.github/workflows/buildBuilderImage.yml b/.github/workflows/buildBuilderImage.yml index e69de29..c6fea02 100644 --- a/.github/workflows/buildBuilderImage.yml +++ b/.github/workflows/buildBuilderImage.yml @@ -0,0 +1,93 @@ +#******************************************************************************* +# buildBuilderImage.yml +# +# Workflow to build a multiarch Docker image that includes all of the tools for +# building maiko for linux. Intended to be used (exclusively?) by the github +# actions that build maiko releases - e.g., buildRelease.yml. +# +# The purpose is to make the maiko github actions quicker and less resource +# consuming by not hving to intll the tools every time and instead just reuse +# this Docker image. +# +# +# Copyright 2023 by Interlisp.org +# +# Frank Haasz 2023-02-21 +# +# ****************************************************************************** + +name: 'Build/Push Builder Image' + +# Run this workflow on ... +on: workflow_dispatch + +defaults: + run: + shell: bash + +jobs: + + buildBuilder: + + runs-on: ubuntu-latest + + steps: + # Checkout just the relevant Dockerfile + - name: Checkout files + uses: Bhacaz/checkout-files@v2 + with: + files: .github/workflows/Dockerfile_builder + + # Checkout the branch of maiko code + #- name: Checkout + # uses: actions/checkout@v3 + + # Setup docker environment variables + - name: Setup Docker Environment Variables + id: docker_env + run: | + DOCKER_REGISTRY="ghcr.io" + DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + DOCKER_REPO=${DOCKER_REGISTRY}/${DOCKER_NAMESPACE}/maiko-builder + DOCKER_TAGS="${DOCKER_REPO}:latest + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} + echo "DOCKER_TAGS=${DOCKER_TAGS}" >> ${GITHUB_ENV} + + # Setup the Docker Machine Emulation environment. + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + # Setup the Docker Buildx funtion + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + # Login to ghcr.io + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Do the Docker Build using the Dockerfile_builder in the repository we + # checked out. Push the result to ghcr.io. + # + - name: Build Docker Images for Push to GHCR + if: ${{ true }} + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + build-args: | + BUILD_DATE=${{ env.BUILD_DATE }} + context: ./.github/workflows + file: ./.github/workflows/Dockerfile_builder + platforms: linux/amd64,linux/arm64,linux/arm/v7 + # Push the result to DockerHub + push: true + tags: ${{ env.DOCKER_TAGS }} + + +######################################################################################