ultimate docker solution
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
name: Sing-box Docker Image CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest release
|
||||
id: get_release
|
||||
run: |
|
||||
latest_release=$(curl -Ls "https://api.github.com/repos/sagernet/sing-box/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
echo "latest_release: $latest_release"
|
||||
echo "latest_release=$latest_release" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
alireza7/s-ui-singbox
|
||||
ghcr.io/alireza0/s-ui-singbox
|
||||
tags: |
|
||||
type=sha
|
||||
type=pep440,pattern=${{ steps.get_release.outputs.latest_release }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: core/
|
||||
push: true
|
||||
build-args: SINGBOX_VER=${{ steps.get_release.outputs.latest_release }}
|
||||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -11,8 +11,6 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
@@ -50,6 +48,6 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -31,6 +31,7 @@ jobs:
|
||||
with:
|
||||
node-version: '20'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install upx -yq
|
||||
@@ -70,13 +71,18 @@ jobs:
|
||||
#### Build Sing-Box
|
||||
git clone -b v1.8.7 https://github.com/SagerNet/sing-box
|
||||
cd 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
|
||||
go build -v -gcflags=all="-l -B -C" -mod=mod -trimpath \
|
||||
-ldflags "-s -w -buildid= -extldflags '-static'" -a \
|
||||
-tags='netgo osusergo static_build with_quic with_grpc with_wireguard with_ech with_utls with_reality_server with_acme with_v2ray_api with_clash_api with_gvisor' \
|
||||
-o sing-box ./cmd/sing-box
|
||||
upx --ultra-brute -9 -v --lzma --best --force sing-box
|
||||
cd ..
|
||||
|
||||
### Build s-ui
|
||||
cd backend
|
||||
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
|
||||
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 ..
|
||||
upx --ultra-brute -9 -v --lzma --best --force sui
|
||||
|
||||
@@ -86,7 +92,7 @@ jobs:
|
||||
cp sing-box.service s-ui/
|
||||
mkdir s-ui/bin
|
||||
cp sing-box/sing-box s-ui/bin/
|
||||
cp runSingbox.sh s-ui/bin/
|
||||
cp core/runSingbox.sh s-ui/bin/
|
||||
|
||||
- name: Package
|
||||
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
|
||||
|
||||
Reference in New Issue
Block a user