feat: adding multi-arch image builds and kubectl manifest deployment
Some checks failed
Test build-and-push (self-test) / Build tiny multi-arch image (push) Failing after 29s
Some checks failed
Test build-and-push (self-test) / Build tiny multi-arch image (push) Failing after 29s
This commit is contained in:
@@ -32,6 +32,12 @@ inputs:
|
||||
description: Path to the Dockerfile (relative to context)
|
||||
required: false
|
||||
default: Dockerfile
|
||||
build_args:
|
||||
description: >-
|
||||
Optional build arguments, one per line in KEY=VALUE form. Each line is
|
||||
appended as a `--build-arg KEY=VALUE` to the build command.
|
||||
required: false
|
||||
default: ""
|
||||
ssh_key:
|
||||
description: SSH private key for the remote Docker builder host (pass via secrets)
|
||||
required: true
|
||||
@@ -75,7 +81,7 @@ runs:
|
||||
# "context deadline exceeded" if the runner can't reach / auth to the
|
||||
# remote docker daemon over SSH. A hard `timeout` wrapper guarantees we
|
||||
# never hang: ConnectTimeout only bounds the TCP handshake.
|
||||
echo "== probing ssh://${BUILDER_USER}@${BUILDER_HOST} =="
|
||||
echo "== probing ssh://***@${BUILDER_HOST} =="
|
||||
if timeout 25 ssh \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
@@ -115,7 +121,7 @@ runs:
|
||||
|
||||
docker context rm -f remote-builder 2>/dev/null || true
|
||||
docker context create remote-builder \
|
||||
--docker "host=ssh://${BUILDER_USER}@${BUILDER_HOST}"
|
||||
--docker "host=ssh://***@${BUILDER_HOST}"
|
||||
|
||||
# Ensure qemu/binfmt is registered on the remote for cross-arch builds.
|
||||
# This registration lives in the kernel and is lost on daemon/host
|
||||
@@ -147,6 +153,21 @@ runs:
|
||||
done
|
||||
echo "tag_args=${TAGS_ARGS}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Generate build args
|
||||
id: genbuildargs
|
||||
shell: bash
|
||||
env:
|
||||
BUILD_ARGS_INPUT: ${{ inputs.build_args }}
|
||||
run: |
|
||||
ARGS=""
|
||||
while IFS= read -r line; do
|
||||
trimmed=$(echo "${line}" | xargs)
|
||||
if [ -n "${trimmed}" ]; then
|
||||
ARGS="${ARGS} --build-arg ${trimmed}"
|
||||
fi
|
||||
done <<< "${BUILD_ARGS_INPUT}"
|
||||
echo "build_args=${ARGS}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and Push Multi-Arch Image
|
||||
shell: bash
|
||||
env:
|
||||
@@ -154,6 +175,7 @@ runs:
|
||||
BUILD_DOCKERFILE: ${{ inputs.build_dockerfile }}
|
||||
PLATFORMS: ${{ inputs.platforms }}
|
||||
TAG_ARGS: ${{ steps.gentags.outputs.tag_args }}
|
||||
BUILD_ARGS: ${{ steps.genbuildargs.outputs.build_args }}
|
||||
run: |
|
||||
unset DOCKER_HOST || true
|
||||
# Build on the remote daemon's default buildkit via the SSH context and
|
||||
@@ -162,6 +184,7 @@ runs:
|
||||
docker --context remote-builder buildx build \
|
||||
--platform "${PLATFORMS}" \
|
||||
--file "${BUILD_CONTEXT}/${BUILD_DOCKERFILE}" \
|
||||
${BUILD_ARGS} \
|
||||
${TAG_ARGS} \
|
||||
--push \
|
||||
"${BUILD_CONTEXT}"
|
||||
|
||||
Reference in New Issue
Block a user