change to static linking when building so older Linux distributions are supported (#5)

This commit is contained in:
Tiger Wang (王豫) 2022-08-22 17:22:27 -04:00 committed by GitHub
parent 8b2af35f39
commit acdbb326bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 10 deletions

View File

@ -18,8 +18,8 @@ jobs:
sudo apt update
sudo apt-get --no-install-recommends --yes install \
libc6-dev-amd64-cross \
gcc-11-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-11-arm-linux-gnueabihf libc6-dev-armhf-cross
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
-
name: Checkout
uses: actions/checkout@v2

View File

@ -10,7 +10,14 @@ builds:
binary: build/sysroot/usr/bin/casaos-user-service
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc-11
- CC=x86_64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
@ -19,7 +26,14 @@ builds:
binary: build/sysroot/usr/bin/casaos-user-service
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc-11
- CC=aarch64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
@ -28,19 +42,33 @@ builds:
binary: build/sysroot/usr/bin/casaos-user-service
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc-11
- CC=arm-linux-gnueabihf-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- 7
- "7"
- id: casaos-user-service-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc-11
- CC=x86_64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
@ -50,7 +78,14 @@ builds:
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc-11
- CC=aarch64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
@ -60,13 +95,20 @@ builds:
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc-11
- CC=arm-linux-gnueabihf-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- 7
- "7"
archives:
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}"
id: casaos-user-service