From 4c89addbad3e879a7301ee5a57c523895b52228e Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 28 Mar 2023 19:52:20 +0800 Subject: [PATCH] build: update docker file --- Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38d108d..d0415f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG GOLANG="golang:1.20-alpine3.17" FROM ${GOLANG} AS xray ENV XRAY="1.8.0" -RUN wget https://github.com/XTLS/Xray-core/archive/refs/tags/v${XRAY}.tar.gz && tar xf v${XRAY}.tar.gz +RUN wget https://github.com/XTLS/Xray-core/archive/v${XRAY}.tar.gz -O- | tar xz WORKDIR ./Xray-core-${XRAY}/main/ RUN go get RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv main /tmp/xray @@ -13,14 +13,18 @@ RUN apk add git COPY ./ /XProxy/ WORKDIR /XProxy/cmd/ RUN go get -RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tag) -s -w" && mv cmd /tmp/xproxy +RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tag) -s -w" +RUN mv cmd /tmp/xproxy + +FROM ${ALPINE} AS geo-data +RUN apk add xz +RUN wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" +RUN wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" +RUN tar cJf /tmp/assets.tar.xz geoip.dat geosite.dat FROM ${ALPINE} AS build -RUN apk add upx xz -WORKDIR /release/ -RUN wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" && \ - wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" && \ - tar cJf assets.tar.xz *.dat && rm *.dat +RUN apk add upx +COPY --from=geo-data /tmp/assets.tar.xz /release/ COPY --from=xproxy /tmp/xproxy /release/usr/bin/ COPY --from=xray /tmp/xray /release/usr/bin/ WORKDIR /release/usr/bin/