Skip to content

Commit 310e66f

Browse files
committed
fix: ARM64平台编译在action会出现段错误
1 parent 9232fc0 commit 310e66f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: docker/build-push-action@v2
3939
with:
4040
context: .
41-
platforms: linux/amd64,linux/arm64,linux/arm/v7
41+
platforms: linux/amd64,linux/arm/v7
4242
push: true
4343
tags: |
4444
${{ secrets.DOCKER_USERNAME }}/channel-monitor:latest

build.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ build() {
3333
fi
3434

3535
echo "Building for ${GOOS}/${GOARCH}..."
36-
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags "${LDFLAGS}" -o "${OUTPUT}" .
37-
36+
if [ "$GOARCH" = "amd64" ] && [ "$GOOS" = "linux" ]; then
37+
CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags "${LDFLAGS}" -o "${OUTPUT}" .
38+
else
39+
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags "${LDFLAGS}" -o "${OUTPUT}" .
40+
fi
41+
3842
if [ $? -eq 0 ]; then
3943
echo "✅ Finished building for ${GOOS}/${GOARCH}"
4044
# 压缩二进制文件

0 commit comments

Comments
 (0)