This commit is contained in:
Alireza Ahmadi
2026-03-09 00:53:16 +01:00
parent 14ea27292f
commit 51cf30f429
9 changed files with 193 additions and 73 deletions
+14 -6
View File
@@ -1,6 +1,7 @@
FROM golang:1.25-alpine AS backend-builder
WORKDIR /app
ARG TARGETARCH
ARG TARGETVARIANT
ENV CGO_ENABLED=1
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
ENV GOARCH=$TARGETARCH
@@ -13,23 +14,30 @@ RUN apk update && apk add --no-cache \
git \
wget \
unzip \
bash
bash \
curl
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 pre-built frontend files from a known location (provided by workflow artifact)
COPY frontend_dist/ /app/web/html/
RUN go build -ldflags="-w -s" \
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor,with_naive_outbound,with_musl" \
RUN if [ "$TARGETARCH" = "arm" ]; then export GOARM=7; [ "$TARGETVARIANT" = "v6" ] && export GOARM=6; fi; \
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
FROM --platform=$TARGETPLATFORM alpine
FROM alpine
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
ENV TZ=Asia/Tehran
WORKDIR /app
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/
ENTRYPOINT [ "./entrypoint.sh" ]