mirror of https://github.com/dnomd343/TProxy
1 changed files with 31 additions and 29 deletions
@ -1,35 +1,37 @@ |
|||||
FROM golang:1.18.1-alpine3.15 AS asset |
FROM golang:1.18-alpine3.16 AS xray |
||||
COPY . /tmp/TProxy |
ENV XRAY_VERSION="v1.5.9" |
||||
ENV UPX_VERSION="3.96" |
|
||||
ENV XRAY_VERSION="v1.5.5" |
|
||||
RUN \ |
RUN \ |
||||
apk add build-base bash make curl git perl ucl-dev zlib-dev && \ |
apk add git && \ |
||||
\ |
git clone https://github.com/XTLS/Xray-core.git && \ |
||||
# upx compile |
cd ./Xray-core/ && git checkout ${XRAY_VERSION} && \ |
||||
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz -P /tmp/ && \ |
|
||||
cd /tmp/ && tar xf upx-${UPX_VERSION}-src.tar.xz && \ |
|
||||
cd upx-${UPX_VERSION}-src && make all && \ |
|
||||
mv ./src/upx.out /usr/bin/upx && \ |
|
||||
\ |
|
||||
# xray-core compile |
|
||||
mkdir -p /asset/usr/bin/ && mkdir -p /asset/run/radvd/ && \ |
|
||||
git clone https://github.com/XTLS/Xray-core.git /tmp/Xray-core && \ |
|
||||
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 /asset/usr/bin/ && \ |
mv ./xray /tmp/ |
||||
\ |
|
||||
# asset download |
# upx can't be compiled under gcc11, so we should use alpine:3.15 |
||||
mkdir -p /asset/etc/xray/asset/ && cd /asset/etc/xray/asset/ && \ |
FROM alpine:3.15 AS upx |
||||
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" && \ |
ENV UPX_VERSION="3.96" |
||||
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" && \ |
RUN \ |
||||
cd /asset/etc/xray/ && tar czf asset.tar.gz ./asset/ && rm -rf ./asset/ && \ |
apk add bash build-base perl ucl-dev zlib-dev && \ |
||||
\ |
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz && \ |
||||
# init script |
tar xf upx-${UPX_VERSION}-src.tar.xz && \ |
||||
mv /tmp/TProxy/load.sh /asset/etc/xray/ && chmod +x /asset/etc/xray/load.sh && \ |
cd upx-${UPX_VERSION}-src/ && make all && \ |
||||
mv /tmp/TProxy/tproxy.sh /asset/tproxy && chmod +x /asset/tproxy |
mv ./src/upx.out /tmp/upx |
||||
|
|
||||
|
FROM alpine:3.16 AS asset |
||||
|
COPY --from=xray /tmp/xray /asset/usr/bin/ |
||||
|
COPY --from=upx /tmp/upx /usr/bin/ |
||||
|
COPY . /TProxy |
||||
|
RUN \ |
||||
|
apk add libgcc libstdc++ ucl && upx -9 /asset/usr/bin/xray && \ |
||||
|
cd /tmp/ && mkdir ./asset/ && mkdir -p /asset/etc/xray/ && \ |
||||
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -P /tmp/asset/ && \ |
||||
|
wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" -P /tmp/asset/ && \ |
||||
|
tar czf asset.tar.gz ./asset/ && mv ./asset.tar.gz /asset/etc/xray/ && \ |
||||
|
mv /TProxy/load.sh /asset/etc/xray/ && chmod +x /asset/etc/xray/load.sh && \ |
||||
|
mv /TProxy/tproxy.sh /asset/tproxy && chmod +x /asset/tproxy |
||||
|
|
||||
FROM alpine:3.15.4 |
FROM alpine:3.16 |
||||
COPY --from=asset /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 && mkdir -p /run/radvd/ |
||||
ENTRYPOINT ["sh","tproxy"] |
ENTRYPOINT ["sh","tproxy"] |
||||
|
Loading…
Reference in new issue