From a05a8835f4fbe9f8ae0c32c03fbda22a9b47cf87 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Thu, 20 Mar 2025 09:04:10 -0500 Subject: [PATCH] Refactor Docker setup to support multi-architecture builds and update base image to Alpine Signed-off-by: Stephen Simpson --- .github/workflows/docker-image-linux.yml | 27 +++++++++++++++++++++--- Dockerfile | 12 ++++++++--- entrypoint.sh | 2 +- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-image-linux.yml b/.github/workflows/docker-image-linux.yml index 3022c24..ee26f73 100644 --- a/.github/workflows/docker-image-linux.yml +++ b/.github/workflows/docker-image-linux.yml @@ -29,12 +29,33 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push + - name: Build and push amd64 uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile push: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 + build-args: | + ARCH=x86_64 tags: | - ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file + ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:amd64 + + - name: Build and push arm64 + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/arm64 + build-args: | + ARCH=aarch64 + tags: | + ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:arm64 + + - name: Create and push manifest + run: | + docker manifest create ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:latest \ + ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:amd64 \ + ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:arm64 + docker manifest push ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 72de729..2b8f8b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ -FROM rockylinux/rockylinux:8.4 +FROM alpine:latest -RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | bash +# Set architecture as a build argument with a default value +ARG ARCH=x86_64 -RUN yum -y install speedtest +RUN apk add --no-cache wget ca-certificates tar + +RUN wget -q https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-${ARCH}.tgz && \ + tar -xzf ookla-speedtest-1.2.0-linux-${ARCH}.tgz -C /usr/bin && \ + rm ookla-speedtest-1.2.0-linux-${ARCH}.tgz && \ + chmod +x /usr/bin/speedtest COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index 4768b32..c91d1ce 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Set terminal type export TERM=xterm-256color