github.com/sagernet/sing-box@v1.9.0-rc.20/Dockerfile (about) 1 FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder 2 LABEL maintainer="nekohasekai <contact-git@sekai.icu>" 3 COPY . /go/src/github.com/sagernet/sing-box 4 WORKDIR /go/src/github.com/sagernet/sing-box 5 ARG TARGETOS TARGETARCH 6 ARG GOPROXY="" 7 ENV GOPROXY ${GOPROXY} 8 ENV CGO_ENABLED=0 9 ENV GOOS=$TARGETOS 10 ENV GOARCH=$TARGETARCH 11 RUN set -ex \ 12 && apk add git build-base \ 13 && export COMMIT=$(git rev-parse --short HEAD) \ 14 && export VERSION=$(go run ./cmd/internal/read_tag) \ 15 && go build -v -trimpath -tags \ 16 "with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api" \ 17 -o /go/bin/sing-box \ 18 -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ 19 ./cmd/sing-box 20 FROM --platform=$TARGETPLATFORM alpine AS dist 21 LABEL maintainer="nekohasekai <contact-git@sekai.icu>" 22 RUN set -ex \ 23 && apk upgrade \ 24 && apk add bash tzdata ca-certificates \ 25 && rm -rf /var/cache/apk/* 26 COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box 27 ENTRYPOINT ["sing-box"]