From e92cf565572a3cf94d3442c3e0b742833e9b065d Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Mon, 6 Jan 2025 00:09:15 +0100 Subject: [PATCH] update docker and release workflow --- .github/workflows/docker-core.yml | 57 ---------------------------- .github/workflows/release.yml | 18 ++------- Dockerfile | 2 +- build.sh | 2 +- docker-compose.yml | 62 +------------------------------ 5 files changed, 6 insertions(+), 135 deletions(-) delete mode 100644 .github/workflows/docker-core.yml diff --git a/.github/workflows/docker-core.yml b/.github/workflows/docker-core.yml deleted file mode 100644 index b0ada90..0000000 --- a/.github/workflows/docker-core.yml +++ /dev/null @@ -1,57 +0,0 @@ -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@v6 - 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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa8eecf..a992777 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,7 +60,7 @@ jobs: cd .. mv frontend/dist backend/web/html - - name: Build s-ui & singbox + - name: Build s-ui run: | export CGO_ENABLED=1 export GOOS=linux @@ -88,27 +88,15 @@ jobs: export CC=s390x-linux-gnu-gcc fi - #### Build Sing-Box - export VERSION=v1.10.1 - git clone -b $VERSION https://github.com/SagerNet/sing-box - cd sing-box - go build -tags with_quic,with_grpc,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_v2ray_api,with_clash_api,with_gvisor \ - -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" \ - -o sing-box ./cmd/sing-box - cd .. - ### Build s-ui cd backend - go build -o ../sui main.go + go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o ../sui main.go cd .. mkdir s-ui cp sui s-ui/ cp s-ui.service s-ui/ - cp sing-box.service s-ui/ - mkdir s-ui/bin - cp sing-box/sing-box s-ui/bin/ - cp core/runSingbox.sh s-ui/bin/ + cp s-ui.sh s-ui/ - name: Package run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui diff --git a/Dockerfile b/Dockerfile index 4d4a10e..eb54353 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV GOARCH=$TARGETARCH RUN apk update && apk --no-cache --update add build-base gcc wget unzip COPY backend/ ./ COPY --from=front-builder /app/dist/ /app/web/html/ -RUN go build -ldflags="-w -s" -o sui main.go +RUN go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o sui main.go FROM --platform=$TARGETPLATFORM alpine LABEL org.opencontainers.image.authors="alireza7@gmail.com" diff --git a/build.sh b/build.sh index bb00705..e18494a 100755 --- a/build.sh +++ b/build.sh @@ -12,4 +12,4 @@ mkdir -p web/html rm -fr web/html/* cp -R ../frontend/dist/* web/html/ -go build -o ../sui main.go +go build -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o ../sui main.go diff --git a/docker-compose.yml b/docker-compose.yml index 167c0d3..f78f5a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,15 +3,10 @@ services: s-ui: image: alireza7/s-ui container_name: s-ui - hostname: "S-UI docker" + hostname: "s-ui" volumes: - - "singbox:/app/bin" - "./db:/app/db" - "./cert:/app/cert" - - "logs:/logs" - environment: - SINGBOX_API: "sing-box:1080" - SUI_DB_FOLDER: "db" tty: true restart: unless-stopped ports: @@ -19,64 +14,9 @@ services: - "2096:2096" networks: - s-ui - links: - - syslog - logging: - driver: syslog - options: - tag: "s-ui" - syslog-address: "udp://127.0.0.1:1514" entrypoint: "./entrypoint.sh" - depends_on: - - syslog - - sing-box: - image: alireza7/s-ui-singbox - container_name: sing-box - volumes: - - "singbox:/app/" - - "./cert:/cert" - networks: - - s-ui - ports: - - "443:443" - - "1443:1443" - - "2443:2443" - - "3443:3443" - restart: unless-stopped - links: - - syslog - logging: - driver: syslog - options: - tag: "sing-box" - syslog-address: "udp://127.0.0.1:1514" - depends_on: - - s-ui - - syslog - - syslog: - image: rsyslog/syslog_appliance_alpine - container_name: syslog - volumes: - - "logs:/logs" - networks: - - s-ui - ports: - - "127.0.0.1:1514:1514/udp" - restart: unless-stopped - environment: - - RSYSLOG_CONF_GLOBAL_CONF=template(name="RemoteLogs" type="string" string="/logs/%programname%.log") - - RSYSLOG_CONF_INPUT_UDP="input(type=\"imudp\" port=\"1514\" ruleset=\"remote\")" - - RSYSLOG_CONF_RULESET_REMOTE="ruleset(name=\"remote\") { action(type=\"omfile\" dynaFile=\"RemoteLogs\") }" - command: > - sh -c 'touch /config/container_config' networks: s-ui: driver: bridge - -volumes: - logs: - singbox: \ No newline at end of file