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