Browse Source

feat: get version info from git describe

v1.x.x
Dnomd343 2 years ago
parent
commit
918480eba1
  1. 7
      Dockerfile
  2. 2
      cmd/xproxy.go

7
Dockerfile

@ -21,16 +21,17 @@ RUN git clone https://github.com/XTLS/Xray-core.git
WORKDIR ./Xray-core/main/ WORKDIR ./Xray-core/main/
RUN git checkout 4c8ee0af50bbabd29e6766f0d9509add6fc0b2e7 RUN git checkout 4c8ee0af50bbabd29e6766f0d9509add6fc0b2e7
RUN go get -d RUN go get
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv main /tmp/xray RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv main /tmp/xray
COPY --from=upx /tmp/upx /usr/bin/ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/xray RUN upx -9 /tmp/xray
FROM ${GOLANG} AS xproxy FROM ${GOLANG} AS xproxy
RUN apk add git
COPY ./ /XProxy/ COPY ./ /XProxy/
WORKDIR /XProxy/cmd/ WORKDIR /XProxy/cmd/
RUN go get -d RUN go get
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv cmd /tmp/xproxy RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tag) -s -w" && mv cmd /tmp/xproxy
COPY --from=upx /tmp/upx /usr/bin/ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/xproxy RUN upx -9 /tmp/xproxy

2
cmd/xproxy.go

@ -15,7 +15,7 @@ import (
"strconv" "strconv"
) )
var version = "1.0.2" var version = "dev"
var v4RouteTable = 104 var v4RouteTable = 104
var v6RouteTable = 106 var v6RouteTable = 106
var v4TProxyPort = 7288 var v4TProxyPort = 7288

Loading…
Cancel
Save