mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-21 14:53:27 +03:00
Enable naive proxy build in Docker image
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,18 +1,23 @@
|
|||||||
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
|
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder
|
||||||
LABEL maintainer="shtorm-7"
|
LABEL maintainer="shtorm-7"
|
||||||
COPY . /go/src/github.com/sagernet/sing-box
|
COPY . /go/src/github.com/sagernet/sing-box
|
||||||
WORKDIR /go/src/github.com/sagernet/sing-box
|
WORKDIR /go/src/github.com/sagernet/sing-box
|
||||||
ARG TARGETOS TARGETARCH
|
ARG TARGETOS TARGETARCH
|
||||||
ARG GOPROXY=""
|
ARG GOPROXY=""
|
||||||
ENV GOPROXY ${GOPROXY}
|
ARG CRONET_GO_PATH=/go/src/github.com/sagernet/sing-box/cronet-go
|
||||||
ENV CGO_ENABLED=0
|
ENV GOPROXY=${GOPROXY}
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
ENV GOOS=$TARGETOS
|
ENV GOOS=$TARGETOS
|
||||||
ENV GOARCH=$TARGETARCH
|
ENV GOARCH=$TARGETARCH
|
||||||
|
ENV CRONET_GO_PATH=${CRONET_GO_PATH}
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk add git build-base \
|
&& git config --global --add safe.directory /go/src/github.com/sagernet/sing-box \
|
||||||
&& export COMMIT=$(git rev-parse --short HEAD) \
|
&& export GOTOOLCHAIN=local \
|
||||||
&& export VERSION=$(go run ./cmd/internal/read_tag) \
|
&& export CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
&& export TAGS=$(cat release/DEFAULT_BUILD_TAGS_OTHERS) \
|
&& eval "$(CGO_ENABLED=0 GOOS= GOARCH= go run -C "$CRONET_GO_PATH" ./cmd/build-naive --target=$GOOS/$GOARCH --libc=musl env --export)" \
|
||||||
|
&& export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-z,notext -Wl,-z,execstack" \
|
||||||
|
&& export VERSION=$(CGO_ENABLED=0 GOOS= GOARCH= go run ./cmd/internal/read_tag) \
|
||||||
|
&& export TAGS=$(cat release/DEFAULT_BUILD_TAGS_DOCKER) \
|
||||||
&& export LDFLAGS_SHARED=$(cat release/LDFLAGS) \
|
&& export LDFLAGS_SHARED=$(cat release/LDFLAGS) \
|
||||||
&& go build -v -trimpath -tags "$TAGS" \
|
&& go build -v -trimpath -tags "$TAGS" \
|
||||||
-o /go/bin/sing-box \
|
-o /go/bin/sing-box \
|
||||||
|
|||||||
Reference in New Issue
Block a user