Dockerfile 766 B

12345678910111213141516171819202122
  1. FROM golang:1.20-alpine AS builder
  2. LABEL maintainer="nekohasekai <[email protected]>"
  3. COPY . /go/src/github.com/sagernet/sing-box
  4. WORKDIR /go/src/github.com/sagernet/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. && go build -v -trimpath -tags with_quic,with_wireguard,with_acme \
  12. -o /go/bin/sing-box \
  13. -ldflags "-s -w -buildid=" \
  14. ./cmd/sing-box
  15. FROM alpine AS dist
  16. LABEL maintainer="nekohasekai <[email protected]>"
  17. RUN set -ex \
  18. && apk upgrade \
  19. && apk add bash tzdata ca-certificates \
  20. && rm -rf /var/cache/apk/*
  21. COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
  22. ENTRYPOINT ["sing-box"]