diff --git a/core/Dockerfile b/core/Dockerfile deleted file mode 100644 index 5b01136..0000000 --- a/core/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS singbox-builder -LABEL maintainer="Alireza " -WORKDIR /app -ARG TARGETOS TARGETARCH -ARG SINGBOX_VER=v1.10.1 -ARG SINGBOX_TAGS="with_quic,with_grpc,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_v2ray_api,with_clash_api,with_gvisor" -ARG GOPROXY="" -ENV GOPROXY ${GOPROXY} -ENV CGO_ENABLED=0 -ENV GOOS=$TARGETOS -ENV GOARCH=$TARGETARCH -RUN apk --no-cache --update add build-base gcc wget unzip git -RUN set -ex \ - && git clone --depth 1 --branch $SINGBOX_VER https://github.com/SagerNet/sing-box.git \ - && cd sing-box \ - && go build -v -trimpath -tags \ - $SINGBOX_TAGS \ - -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$SINGBOX_VER\" -s -w -buildid=" \ - ./cmd/sing-box - -FROM --platform=$TARGETPLATFORM alpine -LABEL maintainer="Alireza " -ENV TZ=Asia/Tehran -WORKDIR /app -RUN apk add --no-cache --update ca-certificates tzdata bash -COPY --from=singbox-builder /app/sing-box/sing-box . -COPY runSingbox.sh . -ENTRYPOINT [ "./runSingbox.sh" ] \ No newline at end of file diff --git a/core/runSingbox.sh b/core/runSingbox.sh deleted file mode 100755 index 78cb32f..0000000 --- a/core/runSingbox.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -e - -tokill=$$ - -runSingbox(){ - ./sing-box run & - tokill=$! -} - -terminateSingbox() -{ - if kill -0 $tokill > /dev/null 2>&1; then - echo "Terminating singbox PID=$tokill" - kill $tokill - while kill -0 $tokill > /dev/null 2>&1; do - sleep 1 - done - fi -} - -reloadSingbox() -{ - if kill -0 $tokill > /dev/null 2>&1; then - kill -HUP $tokill - else - runSingbox - fi -} - -trap terminateSingbox SIGINT SIGTERM SIGKILL -trap reloadSingbox SIGHUP - -runSingbox - -while true -do - sleep 5 - if [ -f "signal" ]; then - signal=`cat signal` - echo "Signal received: $signal" - # Remove singnal file - rm -f signal >> /dev/null 2>&1 - case ${signal} in - "stop") - terminateSingbox - ;; - "restart") - reloadSingbox - ;; - esac - fi - - # Check if sin-box crashed - if ! kill -0 $tokill > /dev/null 2>&1; then - if [ "$signal" != "stop" ]; then - echo "Sing-Box with PID $tokill crashed. Breaking the loop..." - exit 1 - fi - fi -done \ No newline at end of file