2023-07-18 13:36:12 +02:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
platforms:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-09-14 23:11:36 +02:00
|
|
|
cache:
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2023-07-18 13:36:12 +02:00
|
|
|
use_native_arm64_builder:
|
|
|
|
type: boolean
|
|
|
|
push_to_images:
|
|
|
|
type: string
|
2023-08-25 18:26:44 +02:00
|
|
|
version_prerelease:
|
|
|
|
type: string
|
|
|
|
version_metadata:
|
2023-07-18 13:36:12 +02:00
|
|
|
type: string
|
|
|
|
flavor:
|
|
|
|
type: string
|
|
|
|
tags:
|
|
|
|
type: string
|
|
|
|
labels:
|
|
|
|
type: string
|
2023-11-28 11:04:40 +01:00
|
|
|
file_to_build:
|
|
|
|
type: string
|
2023-07-18 13:36:12 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-11 10:41:26 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-18 13:36:12 +02:00
|
|
|
|
2023-09-25 18:41:20 +02:00
|
|
|
- uses: docker/setup-qemu-action@v3
|
2023-07-18 13:36:12 +02:00
|
|
|
if: contains(inputs.platforms, 'linux/arm64') && !inputs.use_native_arm64_builder
|
|
|
|
|
2023-09-25 18:40:41 +02:00
|
|
|
- uses: docker/setup-buildx-action@v3
|
2023-07-18 13:36:12 +02:00
|
|
|
id: buildx
|
|
|
|
if: ${{ !(inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')) }}
|
|
|
|
|
|
|
|
- name: Start a local Docker Builder
|
|
|
|
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')
|
|
|
|
run: |
|
|
|
|
docker run --rm -d --name buildkitd -p 1234:1234 --privileged moby/buildkit:latest --addr tcp://0.0.0.0:1234
|
|
|
|
|
2023-09-25 18:40:41 +02:00
|
|
|
- uses: docker/setup-buildx-action@v3
|
2023-07-18 13:36:12 +02:00
|
|
|
id: buildx-native
|
|
|
|
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')
|
|
|
|
with:
|
|
|
|
driver: remote
|
|
|
|
endpoint: tcp://localhost:1234
|
|
|
|
platforms: linux/amd64
|
|
|
|
append: |
|
|
|
|
- endpoint: tcp://${{ vars.DOCKER_BUILDER_HETZNER_ARM64_01_HOST }}:13865
|
|
|
|
platforms: linux/arm64
|
|
|
|
name: mastodon-docker-builder-arm64-01
|
|
|
|
driver-opts:
|
|
|
|
- servername=mastodon-docker-builder-arm64-01
|
|
|
|
env:
|
|
|
|
BUILDER_NODE_1_AUTH_TLS_CACERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CACERT }}
|
|
|
|
BUILDER_NODE_1_AUTH_TLS_CERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CERT }}
|
|
|
|
BUILDER_NODE_1_AUTH_TLS_KEY: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_KEY }}
|
|
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
if: contains(inputs.push_to_images, 'tootsuite')
|
2023-09-25 18:39:14 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-07-18 13:36:12 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2024-06-08 12:32:39 +02:00
|
|
|
- name: Log in to the GitHub Container registry
|
2023-07-18 13:36:12 +02:00
|
|
|
if: contains(inputs.push_to_images, 'ghcr.io')
|
2023-09-25 18:39:14 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-07-18 13:36:12 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-09-25 18:40:03 +02:00
|
|
|
- uses: docker/metadata-action@v5
|
2023-07-18 13:36:12 +02:00
|
|
|
id: meta
|
|
|
|
if: ${{ inputs.push_to_images != '' }}
|
|
|
|
with:
|
|
|
|
images: ${{ inputs.push_to_images }}
|
|
|
|
flavor: ${{ inputs.flavor }}
|
|
|
|
tags: ${{ inputs.tags }}
|
|
|
|
labels: ${{ inputs.labels }}
|
|
|
|
|
2024-08-13 22:09:38 +02:00
|
|
|
- uses: docker/build-push-action@v6
|
2023-07-18 13:36:12 +02:00
|
|
|
with:
|
|
|
|
context: .
|
2023-11-28 11:04:40 +01:00
|
|
|
file: ${{ inputs.file_to_build }}
|
2023-08-26 17:34:36 +02:00
|
|
|
build-args: |
|
|
|
|
MASTODON_VERSION_PRERELEASE=${{ inputs.version_prerelease }}
|
|
|
|
MASTODON_VERSION_METADATA=${{ inputs.version_metadata }}
|
2024-11-18 09:41:09 +01:00
|
|
|
SOURCE_COMMIT=${{ github.sha }}
|
2023-07-18 13:36:12 +02:00
|
|
|
platforms: ${{ inputs.platforms }}
|
|
|
|
provenance: false
|
|
|
|
builder: ${{ steps.buildx.outputs.name || steps.buildx-native.outputs.name }}
|
|
|
|
push: ${{ inputs.push_to_images != '' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2023-09-15 10:44:01 +02:00
|
|
|
cache-from: ${{ inputs.cache && 'type=gha' || '' }}
|
|
|
|
cache-to: ${{ inputs.cache && 'type=gha,mode=max' || '' }}
|