v1.4.0
This commit is contained in:
@@ -10,6 +10,8 @@ main
|
|||||||
tmp
|
tmp
|
||||||
.sync*
|
.sync*
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
frontend/node_modules
|
||||||
|
frontend/.vite
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
|
|||||||
+128
-57
@@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
frontend-build:
|
frontend-build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6.0.2
|
uses: actions/checkout@v6.0.2
|
||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 24
|
||||||
- name: Install dependencies and build frontend
|
- name: Install dependencies and build frontend
|
||||||
run: |
|
run: |
|
||||||
cd frontend
|
cd frontend
|
||||||
@@ -30,59 +30,130 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: frontend-build
|
needs: frontend-build
|
||||||
runs-on: ubuntu-22.04
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { platform: linux/amd64 }
|
||||||
|
- { platform: linux/386 }
|
||||||
|
- { platform: linux/arm64/v8 }
|
||||||
|
- { platform: linux/arm/v7 }
|
||||||
|
- { platform: linux/arm/v6 }
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6.0.2
|
uses: actions/checkout@v6.0.2
|
||||||
- name: Download frontend build artifact
|
- name: Download frontend build artifact
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v8
|
||||||
with:
|
with:
|
||||||
name: frontend-dist
|
name: frontend-dist
|
||||||
path: frontend_dist
|
path: frontend_dist
|
||||||
- name: Docker meta
|
- name: Prepare
|
||||||
id: meta
|
run: |
|
||||||
uses: docker/metadata-action@v6
|
platform="${{ matrix.platform }}"
|
||||||
with:
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
images: |
|
- name: Docker meta
|
||||||
alireza7/s-ui
|
id: meta
|
||||||
ghcr.io/alireza0/s-ui
|
uses: docker/metadata-action@v6
|
||||||
tags: |
|
with:
|
||||||
type=ref,event=branch
|
images: |
|
||||||
type=ref,event=tag
|
alireza7/s-ui
|
||||||
type=pep440,pattern={{version}}
|
ghcr.io/alireza0/s-ui
|
||||||
- name: Set up QEMU
|
tags: |
|
||||||
uses: docker/setup-qemu-action@v4
|
type=ref,event=branch
|
||||||
- name: Set up Docker Buildx
|
type=ref,event=tag
|
||||||
uses: docker/setup-buildx-action@v4
|
type=pep440,pattern={{version}}
|
||||||
with:
|
- name: Set up QEMU
|
||||||
install: true
|
uses: docker/setup-qemu-action@v4
|
||||||
buildkitd-flags: --debug
|
- name: Set up Docker Buildx
|
||||||
- name: Cache Docker layers
|
uses: docker/setup-buildx-action@v4
|
||||||
uses: actions/cache@v5
|
- name: Cache Docker layers
|
||||||
with:
|
uses: actions/cache@v5
|
||||||
path: /tmp/.buildx-cache
|
with:
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
path: /tmp/.buildx-cache
|
||||||
restore-keys: |
|
key: ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ github.sha }}
|
||||||
${{ runner.os }}-buildx-
|
restore-keys: |
|
||||||
- name: Login to Docker Hub
|
${{ runner.os }}-buildx-${{ matrix.platform }}-
|
||||||
uses: docker/login-action@v4
|
- name: Login to Docker Hub
|
||||||
with:
|
uses: docker/login-action@v4
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
with:
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
- name: Login to GHCR
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
uses: docker/login-action@v4
|
- name: Login to GHCR
|
||||||
with:
|
uses: docker/login-action@v4
|
||||||
registry: ghcr.io
|
with:
|
||||||
username: ${{ github.repository_owner }}
|
registry: ghcr.io
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
username: ${{ github.repository_owner }}
|
||||||
- name: Build and push
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: docker/build-push-action@v7
|
- name: Build and push by digest
|
||||||
with:
|
id: build
|
||||||
context: .
|
uses: docker/build-push-action@v7
|
||||||
file: Dockerfile.frontend-artifact
|
with:
|
||||||
push: true
|
context: .
|
||||||
platforms: linux/amd64, linux/386, linux/arm64/v8, linux/arm/v7, linux/arm/v6
|
file: Dockerfile.frontend-artifact
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
tags: |
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
alireza7/s-ui
|
||||||
|
ghcr.io/alireza0/s-ui
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
||||||
|
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
|
||||||
|
- name: Export digest
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ runner.temp }}/digests
|
||||||
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
|
echo "${digest#sha256:}" > "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: digests-${{ env.PLATFORM_PAIR }}
|
||||||
|
path: ${{ runner.temp }}/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
merge:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Download digests
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
path: ${{ runner.temp }}/digests
|
||||||
|
pattern: digests-*
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
alireza7/s-ui
|
||||||
|
ghcr.io/alireza0/s-ui
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=pep440,pattern={{version}}
|
||||||
|
- name: Create manifest list and push
|
||||||
|
env:
|
||||||
|
DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta.outputs.json }}
|
||||||
|
working-directory: ${{ runner.temp }}/digests
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
for img in alireza7/s-ui ghcr.io/alireza0/s-ui; do
|
||||||
|
TAGS_ARGS=$(echo "$DOCKER_METADATA_OUTPUT_JSON" | jq -cr --arg img "$img" '.tags | map(select(startswith($img))) | map("-t " + .) | join(" ")')
|
||||||
|
DIGEST_REFS=$(for f in *; do echo -n "${img}@sha256:$(cat "$f") "; done)
|
||||||
|
docker buildx imagetools create $TAGS_ARGS $DIGEST_REFS
|
||||||
|
done
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "24"
|
NODE_VERSION: "24"
|
||||||
CRONET_GO_VERSION: "17c7ef18afa63b205e835c6270277b29382eb8e3"
|
CRONET_GO_VERSION: "cba7b9ac0399055aa49fbdc57c03c374f58e1597"
|
||||||
CRONET_GO_REPO: https://github.com/sagernet/cronet-go.git
|
CRONET_GO_REPO: https://github.com/sagernet/cronet-go.git
|
||||||
BOOTLIN_BASE_URL: https://toolchains.bootlin.com/downloads/releases/toolchains
|
BOOTLIN_BASE_URL: https://toolchains.bootlin.com/downloads/releases/toolchains
|
||||||
CHROMIUM_CACHE_KEY_SUFFIX: musl-17c7ef18afa6
|
CHROMIUM_CACHE_KEY_SUFFIX: musl-cba7b9ac0399055aa49fbdc57c03c374f58e1597
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-frontend:
|
build-frontend:
|
||||||
|
|||||||
+14
-5
@@ -6,6 +6,7 @@ RUN npm install && npm run build
|
|||||||
FROM golang:1.25-alpine AS backend-builder
|
FROM golang:1.25-alpine AS backend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=1
|
||||||
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
||||||
ENV GOARCH=$TARGETARCH
|
ENV GOARCH=$TARGETARCH
|
||||||
@@ -18,22 +19,30 @@ RUN apk update && apk add --no-cache \
|
|||||||
git \
|
git \
|
||||||
wget \
|
wget \
|
||||||
unzip \
|
unzip \
|
||||||
bash
|
bash \
|
||||||
|
curl
|
||||||
|
|
||||||
ENV CC=gcc
|
ENV CC=gcc
|
||||||
|
|
||||||
|
RUN CRONET_ARCH="$TARGETARCH" && \
|
||||||
|
CRONET_URL="https://github.com/SagerNet/cronet-go/releases/latest/download/libcronet-linux-${CRONET_ARCH}.so"; \
|
||||||
|
echo "Downloading $CRONET_URL" && \
|
||||||
|
wget -q -O ./libcronet.so "$CRONET_URL" && \
|
||||||
|
chmod 755 ./libcronet.so
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=front-builder /app/dist/ /app/web/html/
|
COPY --from=front-builder /app/dist/ /app/web/html/
|
||||||
|
|
||||||
RUN go build -ldflags="-w -s" \
|
RUN if [ "$TARGETARCH" = "arm" ]; then export GOARM=7; [ "$TARGETVARIANT" = "v6" ] && export GOARM=6; fi; \
|
||||||
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_musl" \
|
go build -ldflags="-w -s" \
|
||||||
|
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_purego" \
|
||||||
-o sui main.go
|
-o sui main.go
|
||||||
|
|
||||||
FROM --platform=$TARGETPLATFORM alpine
|
FROM alpine
|
||||||
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
|
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
|
||||||
ENV TZ=Asia/Tehran
|
ENV TZ=Asia/Tehran
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN set -ex && apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
RUN set -ex && apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
||||||
COPY --from=backend-builder /app/sui /app/
|
COPY --from=backend-builder /app/sui /app/libcronet.so /app/
|
||||||
COPY entrypoint.sh /app/
|
COPY entrypoint.sh /app/
|
||||||
ENTRYPOINT [ "./entrypoint.sh" ]
|
ENTRYPOINT [ "./entrypoint.sh" ]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
FROM golang:1.25-alpine AS backend-builder
|
FROM golang:1.25-alpine AS backend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=1
|
||||||
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
||||||
ENV GOARCH=$TARGETARCH
|
ENV GOARCH=$TARGETARCH
|
||||||
@@ -13,23 +14,30 @@ RUN apk update && apk add --no-cache \
|
|||||||
git \
|
git \
|
||||||
wget \
|
wget \
|
||||||
unzip \
|
unzip \
|
||||||
bash
|
bash \
|
||||||
|
curl
|
||||||
|
|
||||||
ENV CC=gcc
|
ENV CC=gcc
|
||||||
|
|
||||||
|
RUN CRONET_ARCH="$TARGETARCH" && \
|
||||||
|
CRONET_URL="https://github.com/SagerNet/cronet-go/releases/latest/download/libcronet-linux-${CRONET_ARCH}.so"; \
|
||||||
|
echo "Downloading $CRONET_URL" && \
|
||||||
|
wget -q -O ./libcronet.so "$CRONET_URL" && \
|
||||||
|
chmod 755 ./libcronet.so
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# Copy pre-built frontend files from a known location (provided by workflow artifact)
|
|
||||||
COPY frontend_dist/ /app/web/html/
|
COPY frontend_dist/ /app/web/html/
|
||||||
|
|
||||||
RUN go build -ldflags="-w -s" \
|
RUN if [ "$TARGETARCH" = "arm" ]; then export GOARM=7; [ "$TARGETVARIANT" = "v6" ] && export GOARM=6; fi; \
|
||||||
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_musl" \
|
go build -ldflags="-w -s" \
|
||||||
|
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_purego" \
|
||||||
-o sui main.go
|
-o sui main.go
|
||||||
|
|
||||||
FROM --platform=$TARGETPLATFORM alpine
|
FROM alpine
|
||||||
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
|
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
|
||||||
ENV TZ=Asia/Tehran
|
ENV TZ=Asia/Tehran
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN set -ex && apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
RUN set -ex && apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
||||||
COPY --from=backend-builder /app/sui /app/
|
COPY --from=backend-builder /app/sui /app/libcronet.so /app/
|
||||||
COPY entrypoint.sh /app/
|
COPY entrypoint.sh /app/
|
||||||
ENTRYPOINT [ "./entrypoint.sh" ]
|
ENTRYPOINT [ "./entrypoint.sh" ]
|
||||||
@@ -11,4 +11,5 @@ mkdir -p web/html
|
|||||||
rm -fr web/html/*
|
rm -fr web/html/*
|
||||||
cp -R frontend/dist/* web/html/
|
cp -R frontend/dist/* web/html/
|
||||||
|
|
||||||
go build -ldflags "-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go
|
BUILD_TAGS="with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_musl,badlinkname,tfogo_checklinkname0"
|
||||||
|
go build -ldflags '-w -s -checklinkname=0 -extldflags "-Wl,-no_warn_duplicate_libraries"' -tags "$BUILD_TAGS" -o sui main.go
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.3.11
|
1.4.0
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Test Docker multi-platform build (linux/amd64, 386, arm64, arm/v7, arm/v6)
|
||||||
|
# Requires: frontend_dist/ (run from repo root after building frontend)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
echo "==> Preparing frontend_dist..."
|
||||||
|
if [ ! -d "frontend_dist" ] || [ -z "$(ls -A frontend_dist 2>/dev/null)" ]; then
|
||||||
|
echo "Building frontend..."
|
||||||
|
(cd frontend && npm install --prefer-offline --no-audit && npm run build)
|
||||||
|
rm -rf frontend_dist
|
||||||
|
mkdir -p frontend_dist
|
||||||
|
cp -R frontend/dist/* frontend_dist/
|
||||||
|
echo "frontend_dist ready."
|
||||||
|
else
|
||||||
|
echo "frontend_dist exists, skipping frontend build."
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLATFORMS="linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6"
|
||||||
|
echo "==> Testing Docker build for: $PLATFORMS"
|
||||||
|
docker buildx build \
|
||||||
|
--platform "$PLATFORMS" \
|
||||||
|
-f Dockerfile.frontend-artifact \
|
||||||
|
--build-arg CRONET_RELEASE=latest \
|
||||||
|
--progress=plain \
|
||||||
|
. 2>&1 | tee docker-build-test.log
|
||||||
|
|
||||||
|
echo "==> Done. Check docker-build-test.log for full output."
|
||||||
+1
-1
Submodule frontend updated: 2d5a20f967...1a62b65513
Reference in New Issue
Block a user