Skip to content

Commit 762fed1

Browse files
committed
Fix Docker build for loong64
Use debian:stable-slim as base image for loong64 since Alpine has no loong64 support.
1 parent 9383e71 commit 762fed1

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

.github/workflows/docker.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Publish Docker Images
22

33
on:
4-
#push:
5-
# branches:
6-
# - main-next
7-
# - dev-next
4+
push:
5+
branches:
6+
- main-next
7+
- dev-next
88
release:
99
types:
1010
- published
@@ -160,17 +160,17 @@ jobs:
160160
strategy:
161161
fail-fast: true
162162
matrix:
163-
platform:
164-
- linux/amd64
165-
- linux/arm/v6
166-
- linux/arm/v7
167-
- linux/arm64
168-
- linux/386
169-
- linux/mipsle
170-
- linux/ppc64le
171-
- linux/riscv64
172-
- linux/s390x
173-
- linux/loong64
163+
include:
164+
- { platform: "linux/amd64" }
165+
- { platform: "linux/arm/v6" }
166+
- { platform: "linux/arm/v7" }
167+
- { platform: "linux/arm64" }
168+
- { platform: "linux/386" }
169+
- { platform: "linux/mipsle" }
170+
- { platform: "linux/ppc64le" }
171+
- { platform: "linux/riscv64" }
172+
- { platform: "linux/s390x" }
173+
- { platform: "linux/loong64", base_image: "debian:stable-slim" }
174174
steps:
175175
- name: Get commit to build
176176
id: ref
@@ -223,6 +223,8 @@ jobs:
223223
platforms: ${{ matrix.platform }}
224224
context: .
225225
file: Dockerfile.binary
226+
build-args: |
227+
BASE_IMAGE=${{ matrix.base_image || 'alpine' }}
226228
labels: ${{ steps.meta.outputs.labels }}
227229
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
228230
- name: Export digest
@@ -238,6 +240,7 @@ jobs:
238240
if-no-files-found: error
239241
retention-days: 1
240242
merge:
243+
if: github.event_name != 'push'
241244
runs-on: ubuntu-latest
242245
needs:
243246
- build_docker

Dockerfile.binary

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
FROM alpine
1+
ARG BASE_IMAGE=alpine
2+
FROM ${BASE_IMAGE}
23
ARG TARGETARCH
34
ARG TARGETVARIANT
45
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
56
RUN set -ex \
6-
&& apk add --no-cache --upgrade bash tzdata ca-certificates nftables
7+
&& if command -v apk > /dev/null; then \
8+
apk add --no-cache --upgrade bash tzdata ca-certificates nftables; \
9+
else \
10+
apt-get update && apt-get install -y --no-install-recommends bash tzdata ca-certificates nftables \
11+
&& rm -rf /var/lib/apt/lists/*; \
12+
fi
713
COPY sing-box-${TARGETARCH}${TARGETVARIANT} /usr/local/bin/sing-box
814
ENTRYPOINT ["sing-box"]

0 commit comments

Comments
 (0)