Skip to content

🛠️ Manually build ALL buildboxes #9

🛠️ Manually build ALL buildboxes

🛠️ Manually build ALL buildboxes #9

---
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.
name: Manually build ALL buildboxes
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Variables available to all jobs defined in this file
env:
DOCKER_BUILDKIT: 1
REGISTRY: ${{ vars.REGISTRY }}
# Declare default permissions as read only.
permissions: read-all
jobs:
generate:
runs-on: ubuntu-latest
name: Generate build matrix
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
dockerfile: [
"alpine/Dockerfile.v3.17", # Until 2024-11-22
"alpine/Dockerfile.v3.18", # Until 2025-05-09
"alpine/Dockerfile.v3.19", # Until 2025-11-01
# "amzn/Dockerfile.v2", # Until 2025-06-30
# "amzn/Dockerfile.v2023", # Until 2028-03-15
"ubuntu/Dockerfile.v20.04", # Until 2025-04-02 (LTS)
"ubuntu/Dockerfile.v22.04", # Until 2027-04-01 (LTS)
]
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
- name: Git clone
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
platforms: linux/amd64,linux/arm64
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image (multiarch)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euxo pipefail
export DIR="buildboxes/$(echo "${{ matrix.dockerfile }}" | cut -d '/' -f 1)"
export DFILE="$(echo "${{ matrix.dockerfile }}" | cut -d '/' -f 2)"
export IMAGE="$(echo "${{ matrix.dockerfile }}" | sed "s|/Dockerfile.|-|g")"
cp -vf download-asset.toml "${DIR}/download-asset.toml"
cd "${DIR}" && \
docker buildx build \
--no-cache \
--platform "linux/amd64,linux/arm64" \
--tag ghcr.io/northwood-labs/package-builder/${IMAGE}:latest \
--file "${DFILE}" \
--secret id=GITHUB_TOKEN,env=GITHUB_TOKEN \
--output=type=registry \
--compress \
--force-rm \
--build-arg BUILD_DATE=$(date "+%Y-%m-%d") \
--build-arg "VCS_REF=$(git log --pretty=format:'%h' -n 1 | tr -d '\n')" \
.