workflows: Optimize and reduce binary size (#76)
* workflows: Optimize and reduce binary size Signed-off-by: dopaemon <polarisdp@gmail.com> * workflows: add tags osusergo Signed-off-by: dopaemon <polarisdp@gmail.com> --------- Signed-off-by: dopaemon <polarisdp@gmail.com>
This commit is contained in:
committed by
GitHub
parent
52db4e5332
commit
5726e64b9f
@@ -31,10 +31,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update && sudo apt-get install upx -yq
|
||||||
if [ "${{ matrix.platform }}" == "arm64" ]; then
|
if [ "${{ matrix.platform }}" == "arm64" ]; then
|
||||||
sudo apt install gcc-aarch64-linux-gnu
|
sudo apt install gcc-aarch64-linux-gnu
|
||||||
elif [ "${{ matrix.platform }}" == "armv7" ]; then
|
elif [ "${{ matrix.platform }}" == "armv7" ]; then
|
||||||
@@ -71,14 +70,16 @@ jobs:
|
|||||||
#### Build Sing-Box
|
#### Build Sing-Box
|
||||||
git clone -b v1.8.7 https://github.com/SagerNet/sing-box
|
git clone -b v1.8.7 https://github.com/SagerNet/sing-box
|
||||||
cd sing-box
|
cd sing-box
|
||||||
go build -tags with_v2ray_api,with_clash_api,with_grpc,with_quic,with_ech -o sing-box ./cmd/sing-box
|
go build -v -gcflags=all="-l -B -C" -mod=mod -trimpath -ldflags "-s -w -buildid= -extldflags '-static'" -a -tags='netgo osusergo static_build with_v2ray_api with_clash_api with_grpc with_quic with_ech' -o sing-box ./cmd/sing-box
|
||||||
|
upx --ultra-brute -9 -v --lzma --best --force sing-box
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
### Build s-ui
|
### Build s-ui
|
||||||
cd backend
|
cd backend
|
||||||
go build -o ../sui main.go
|
go build -v -gcflags=all="-l -B -C" -mod=mod -trimpath -ldflags "-s -w -buildid= -extldflags '-static'" -a -tags='netgo osusergo static_build sqlite_omit_load_extension' -o ../sui main.go
|
||||||
cd ..
|
cd ..
|
||||||
|
upx --ultra-brute -9 -v --lzma --best --force sui
|
||||||
|
|
||||||
mkdir s-ui
|
mkdir s-ui
|
||||||
cp sui s-ui/
|
cp sui s-ui/
|
||||||
cp s-ui.service s-ui/
|
cp s-ui.service s-ui/
|
||||||
@@ -86,10 +87,10 @@ jobs:
|
|||||||
mkdir s-ui/bin
|
mkdir s-ui/bin
|
||||||
cp sing-box/sing-box s-ui/bin/
|
cp sing-box/sing-box s-ui/bin/
|
||||||
cp runSingbox.sh s-ui/bin/
|
cp runSingbox.sh s-ui/bin/
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
|
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user