|
@ -1,9 +1,9 @@ |
|
|
FROM alpine:3.15 as asset |
|
|
FROM golang:1.17.8-alpine3.15 AS asset |
|
|
COPY . /tmp/TProxy |
|
|
COPY . /tmp/TProxy |
|
|
ENV UPX_VERSION="3.96" |
|
|
ENV UPX_VERSION="3.96" |
|
|
ENV XRAY_VERSION="v1.5.3" |
|
|
ENV XRAY_VERSION="v1.5.3" |
|
|
RUN \ |
|
|
RUN \ |
|
|
apk add build-base bash make curl go git perl ucl-dev zlib-dev && \ |
|
|
apk add build-base bash make curl git perl ucl-dev zlib-dev && \ |
|
|
\ |
|
|
\ |
|
|
# upx compile |
|
|
# upx compile |
|
|
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz -P /tmp/ && \ |
|
|
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz -P /tmp/ && \ |
|
@ -12,25 +12,24 @@ RUN \ |
|
|
mv ./src/upx.out /usr/bin/upx && \ |
|
|
mv ./src/upx.out /usr/bin/upx && \ |
|
|
\ |
|
|
\ |
|
|
# xray-core compile |
|
|
# xray-core compile |
|
|
mkdir -p /tmp/asset/usr/bin/ && mkdir -p /tmp/asset/run/radvd/ && \ |
|
|
mkdir -p /asset/usr/bin/ && mkdir -p /asset/run/radvd/ && \ |
|
|
git clone https://github.com/XTLS/Xray-core.git /tmp/Xray-core && \ |
|
|
git clone https://github.com/XTLS/Xray-core.git /tmp/Xray-core && \ |
|
|
cd /tmp/Xray-core/ && git checkout $XRAY_VERSION && \ |
|
|
cd /tmp/Xray-core/ && git checkout $XRAY_VERSION && \ |
|
|
env CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w" ./main && \ |
|
|
env CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w" ./main && \ |
|
|
upx -9 ./xray && mv ./xray /tmp/asset/usr/bin/ && \ |
|
|
upx -9 ./xray && mv ./xray /asset/usr/bin/ && \ |
|
|
\ |
|
|
\ |
|
|
# asset download |
|
|
# asset download |
|
|
mkdir -p /tmp/asset/etc/xray/asset/ && cd /tmp/asset/etc/xray/asset/ && \ |
|
|
mkdir -p /asset/etc/xray/asset/ && cd /asset/etc/xray/asset/ && \ |
|
|
GEO_VERSION=$(curl -sL "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') && \ |
|
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" && \ |
|
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/$GEO_VERSION/geoip.dat" && \ |
|
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" && \ |
|
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/$GEO_VERSION/geosite.dat" && \ |
|
|
cd /asset/etc/xray/ && tar czf asset.tar.gz ./asset/ && rm -rf ./asset/ && \ |
|
|
cd /tmp/asset/etc/xray/ && tar czf asset.tar.gz asset/ && rm -rf asset/ && \ |
|
|
|
|
|
\ |
|
|
\ |
|
|
# init script |
|
|
# init script |
|
|
mv /tmp/TProxy/load.sh /tmp/asset/etc/xray/ && chmod +x /tmp/asset/etc/xray/load.sh && \ |
|
|
mv /tmp/TProxy/load.sh /asset/etc/xray/ && chmod +x /asset/etc/xray/load.sh && \ |
|
|
mv /tmp/TProxy/tproxy.sh /tmp/asset/tproxy && chmod +x /tmp/asset/tproxy |
|
|
mv /tmp/TProxy/tproxy.sh /asset/tproxy && chmod +x /asset/tproxy |
|
|
|
|
|
|
|
|
FROM alpine:3.15 |
|
|
FROM alpine:3.15.2 |
|
|
COPY --from=asset /tmp/asset/ / |
|
|
COPY --from=asset /asset/ / |
|
|
ENV XRAY_LOCATION_ASSET=/etc/xray/asset |
|
|
ENV XRAY_LOCATION_ASSET=/etc/xray/asset |
|
|
RUN apk add --no-cache iptables ip6tables radvd |
|
|
RUN apk add --no-cache iptables ip6tables radvd |
|
|
ENTRYPOINT ["sh","tproxy"] |
|
|
ENTRYPOINT ["sh","tproxy"] |
|
|