Skip to content

Commit b8148b4

Browse files
author
cyk
committed
Merge branch 'x64' into 115
2 parents 31a004a + 27f2040 commit b8148b4

File tree

2 files changed

+27
-41
lines changed

2 files changed

+27
-41
lines changed

.github/workflows/test_docker.yml

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
name: Beta Release (Docker)
2-
32
on:
43
workflow_dispatch:
54
push:
65
branches:
76
- main
87
pull_request:
98
branches:
10-
- main
9+
- fix # 👈 允许你的 fix 分支触发
1110

1211
concurrency:
1312
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1413
cancel-in-progress: true
1514

1615
env:
17-
DOCKERHUB_ORG_NAME: ${{ vars.DOCKERHUB_ORG_NAME || 'openlistteam' }}
18-
GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'openlistteam' }}
19-
IMAGE_NAME: openlist-git
20-
IMAGE_NAME_DOCKERHUB: openlist
16+
GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'ironboxplus' }} # 👈 最好改成你的用户名,防止推错地方
17+
IMAGE_NAME: openlist
2118
REGISTRY: ghcr.io
2219
ARTIFACT_NAME: 'binaries_docker_release'
23-
RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/ppc64le,linux/riscv64,linux/loong64' ### Temporarily disable Docker builds for linux/s390x architectures for unknown reasons.
24-
IMAGE_PUSH: ${{ github.event_name == 'push' }}
20+
# 👇 关键修改:只保留 linux/amd64,删掉后面一长串
21+
RELEASE_PLATFORMS: 'linux/amd64'
22+
# 👇 关键修改:强制允许推送,不用管是不是 push 事件
23+
IMAGE_PUSH: 'true'
2524
IMAGE_TAGS_BETA: |
2625
type=ref,event=pr
27-
type=raw,value=beta,enable={{is_default_branch}}
26+
type=raw,value=beta
2827
2928
jobs:
3029
build_binary:
31-
name: Build Binaries for Docker Release (Beta)
30+
name: Build Binaries (x64 Only)
3231
runs-on: ubuntu-latest
3332
steps:
3433
- name: Checkout
3534
uses: actions/checkout@v4
36-
3735
- uses: actions/setup-go@v5
3836
with:
3937
go-version: '1.25.0'
4038

39+
# 即使只构建 x64,我们也需要 musl 工具链(因为 BuildDockerMultiplatform 默认会检查它)
4140
- name: Cache Musl
4241
id: cache-musl
4342
uses: actions/cache@v4
4443
with:
4544
path: build/musl-libs
4645
key: docker-musl-libs-v2
47-
4846
- name: Download Musl Library
4947
if: steps.cache-musl.outputs.cache-hit != 'true'
5048
run: bash build.sh prepare docker-multiplatform
5149
env:
5250
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5351

54-
- name: Build go binary (beta)
52+
- name: Build go binary
53+
# 这里还是跑 docker-multiplatform,虽然会多编译一些架构,但这是兼容 Dockerfile 路径最稳妥的方法
5554
run: bash build.sh beta docker-multiplatform
5655
env:
5756
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -69,12 +68,13 @@ jobs:
6968
7069
release_docker:
7170
needs: build_binary
72-
name: Release Docker image (Beta)
71+
name: Release Docker (x64)
7372
runs-on: ubuntu-latest
7473
permissions:
7574
packages: write
7675
strategy:
7776
matrix:
77+
# 你可以选择只构建 latest,或者保留全部变体
7878
image: ["latest", "ffmpeg", "aria2", "aio"]
7979
include:
8080
- image: "latest"
@@ -102,46 +102,32 @@ jobs:
102102
with:
103103
name: ${{ env.ARTIFACT_NAME }}
104104
path: 'build/'
105-
106-
- name: Set up QEMU
107-
uses: docker/setup-qemu-action@v3
108-
109105
- name: Set up Docker Buildx
110106
uses: docker/setup-buildx-action@v3
111107

108+
# 👇 只保留 GitHub 登录,删除了 DockerHub 登录
112109
- name: Login to GitHub Container Registry
113-
if: env.IMAGE_PUSH == 'true'
114110
uses: docker/login-action@v3
115111
with:
116112
registry: ${{ env.REGISTRY }}
117113
username: ${{ github.actor }}
118114
password: ${{ secrets.GITHUB_TOKEN }}
119115

120-
- name: Login to DockerHub Container Registry
121-
if: env.IMAGE_PUSH == 'true'
122-
uses: docker/login-action@v3
123-
with:
124-
username: ${{ vars.DOCKERHUB_ORG_NAME_BACKUP || env.DOCKERHUB_ORG_NAME }}
125-
password: ${{ secrets.DOCKERHUB_TOKEN }}
126-
127116
- name: Docker meta
128117
id: meta
129118
uses: docker/metadata-action@v5
130119
with:
131120
images: |
132121
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
133-
${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
134122
tags: ${{ env.IMAGE_TAGS_BETA }}
135-
flavor: |
136-
${{ matrix.tag_favor }}
123+
flavor: ${{ matrix.tag_favor }}
137124

138125
- name: Build and push
139-
id: docker_build
140126
uses: docker/build-push-action@v6
141127
with:
142128
context: .
143129
file: Dockerfile.ci
144-
push: ${{ env.IMAGE_PUSH == 'true' }}
130+
push: true
145131
build-args: |
146132
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
147133
${{ matrix.build_arg }}

build.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ BuildDockerMultiplatform() {
186186
docker_lflags="--extldflags '-static -fpic' $ldflags"
187187
export CGO_ENABLED=1
188188

189-
OS_ARCHES=(linux-amd64 linux-arm64 linux-386 linux-riscv64 linux-ppc64le linux-loong64) ## Disable linux-s390x builds
190-
CGO_ARGS=(x86_64-linux-musl-gcc aarch64-linux-musl-gcc i486-linux-musl-gcc riscv64-linux-musl-gcc powerpc64le-linux-musl-gcc loongarch64-linux-musl-gcc) ## Disable s390x-linux-musl-gcc builds
189+
OS_ARCHES=(linux-amd64) ## Disable linux-s390x builds
190+
CGO_ARGS=(x86_64-linux-musl-gcc) ## Disable s390x-linux-musl-gcc builds
191191
for i in "${!OS_ARCHES[@]}"; do
192192
os_arch=${OS_ARCHES[$i]}
193193
cgo_cc=${CGO_ARGS[$i]}
@@ -205,14 +205,14 @@ BuildDockerMultiplatform() {
205205
GO_ARM=(6 7)
206206
export GOOS=linux
207207
export GOARCH=arm
208-
for i in "${!DOCKER_ARM_ARCHES[@]}"; do
209-
docker_arch=${DOCKER_ARM_ARCHES[$i]}
210-
cgo_cc=${CGO_ARGS[$i]}
211-
export GOARM=${GO_ARM[$i]}
212-
export CC=${cgo_cc}
213-
echo "building for $docker_arch"
214-
go build -o build/${docker_arch%%-*}/${docker_arch##*-}/"$appName" -ldflags="$docker_lflags" -tags=jsoniter .
215-
done
208+
# for i in "${!DOCKER_ARM_ARCHES[@]}"; do
209+
# docker_arch=${DOCKER_ARM_ARCHES[$i]}
210+
# cgo_cc=${CGO_ARGS[$i]}
211+
# export GOARM=${GO_ARM[$i]}
212+
# export CC=${cgo_cc}
213+
# echo "building for $docker_arch"
214+
# go build -o build/${docker_arch%%-*}/${docker_arch##*-}/"$appName" -ldflags="$docker_lflags" -tags=jsoniter .
215+
# done
216216
}
217217

218218
BuildRelease() {

0 commit comments

Comments
 (0)