From 0817c25f4c661fd3087fc96cebec1d856af4387c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 23 Feb 2026 14:32:32 +0800 Subject: [PATCH] release: Fix Docker build for loong64 and mipsle --- .github/workflows/docker.yml | 25 ++++++++++++++----------- Dockerfile.binary | 10 ++++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fd8845eb9..0cb256fdd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -160,17 +160,17 @@ jobs: strategy: fail-fast: true matrix: - platform: - - linux/amd64 - - linux/arm/v6 - - linux/arm/v7 - - linux/arm64 - - linux/386 - - linux/mipsle - - linux/ppc64le - - linux/riscv64 - - linux/s390x - - linux/loong64 + include: + - { platform: "linux/amd64" } + - { platform: "linux/arm/v6" } + - { platform: "linux/arm/v7" } + - { platform: "linux/arm64" } + - { platform: "linux/386" } + # mipsle: no base Docker image available for this platform + - { platform: "linux/ppc64le" } + - { platform: "linux/riscv64" } + - { platform: "linux/s390x" } + - { platform: "linux/loong64", base_image: "ghcr.io/loong64/alpine:edge" } steps: - name: Get commit to build id: ref @@ -223,6 +223,8 @@ jobs: platforms: ${{ matrix.platform }} context: . file: Dockerfile.binary + build-args: | + BASE_IMAGE=${{ matrix.base_image || 'alpine' }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - name: Export digest @@ -238,6 +240,7 @@ jobs: if-no-files-found: error retention-days: 1 merge: + if: github.event_name != 'push' runs-on: ubuntu-latest needs: - build_docker diff --git a/Dockerfile.binary b/Dockerfile.binary index ac46e53ab..78fc56672 100644 --- a/Dockerfile.binary +++ b/Dockerfile.binary @@ -1,8 +1,14 @@ -FROM alpine +ARG BASE_IMAGE=alpine +FROM ${BASE_IMAGE} ARG TARGETARCH ARG TARGETVARIANT LABEL maintainer="nekohasekai " RUN set -ex \ - && apk add --no-cache --upgrade bash tzdata ca-certificates nftables + && if command -v apk > /dev/null; then \ + apk add --no-cache --upgrade bash tzdata ca-certificates nftables; \ + else \ + apt-get update && apt-get install -y --no-install-recommends bash tzdata ca-certificates nftables \ + && rm -rf /var/lib/apt/lists/*; \ + fi COPY sing-box-${TARGETARCH}${TARGETVARIANT} /usr/local/bin/sing-box ENTRYPOINT ["sing-box"]