Skip to content

Build/Push Builder Image #17

Build/Push Builder Image

Build/Push Builder Image #17

#*******************************************************************************
# 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 maiko
- name: Checkout maiko
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 }}
######################################################################################