|
|
@ -1,5 +1,5 @@ |
|
|
|
ARG ALPINE_IMG="alpine:3.16" |
|
|
|
ARG RUST_IMG="rust:1.63-alpine3.16" |
|
|
|
ARG RUST_IMG="rust:1.64-alpine3.16" |
|
|
|
ARG GO14_IMG="golang:1.14-alpine3.13" |
|
|
|
ARG GO16_IMG="golang:1.16-alpine3.15" |
|
|
|
ARG GO17_IMG="golang:1.17-alpine3.16" |
|
|
@ -10,52 +10,53 @@ ARG PYTHON_IMG="python:3.10-alpine3.16" |
|
|
|
# Download build-base |
|
|
|
FROM ${ALPINE_IMG} AS build-base |
|
|
|
WORKDIR /apk/ |
|
|
|
RUN echo "apk add --no-network \\" > ./build-base && chmod +x ./build-base && \ |
|
|
|
apk update && apk fetch -R build-base | grep -oE '\S+$' | awk '{print "/apk/"$0".apk \\"}' >> ./build-base |
|
|
|
RUN echo -e "cd \`dirname \$0\`\napk add --no-network \\" > setup && chmod +x setup && \ |
|
|
|
apk update && apk fetch -R build-base cmake | grep -oE '\S+$' | awk '{print "./"$0".apk \\"}' >> setup |
|
|
|
|
|
|
|
# Compile python3 module numpy |
|
|
|
FROM ${PYTHON_IMG} AS numpy |
|
|
|
WORKDIR /wheels/ |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && pip wheel numpy |
|
|
|
WORKDIR /wheels/ |
|
|
|
RUN /apk/setup && pip wheel numpy |
|
|
|
|
|
|
|
# Compile python3 module gevent |
|
|
|
FROM ${PYTHON_IMG} AS gevent |
|
|
|
WORKDIR /wheels/ |
|
|
|
RUN apk add libffi-dev |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && pip wheel gevent |
|
|
|
WORKDIR /wheels/ |
|
|
|
RUN /apk/setup && pip wheel gevent |
|
|
|
|
|
|
|
# Build python3 wheels |
|
|
|
FROM ${PYTHON_IMG} AS wheels |
|
|
|
WORKDIR /wheels/ |
|
|
|
RUN apk add linux-headers |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && pip wheel colorlog flask IPy psutil pysocks pyyaml requests salsa20 |
|
|
|
WORKDIR /wheels/ |
|
|
|
RUN /apk/setup && pip wheel colorlog flask IPy psutil pysocks pyyaml requests salsa20 |
|
|
|
COPY --from=gevent /wheels/*.whl /wheels/ |
|
|
|
COPY --from=numpy /wheels/*.whl /wheels/ |
|
|
|
|
|
|
|
# Compile upx (use gcc10 for now) |
|
|
|
# Compile upx |
|
|
|
FROM ${ALPINE_IMG} AS upx |
|
|
|
ENV UPX_VERSION="3.96" |
|
|
|
RUN sed -i 's/v3.\d\d/v3.15/' /etc/apk/repositories && apk add bash build-base perl ucl-dev zlib-dev |
|
|
|
RUN wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz && tar xf upx-${UPX_VERSION}-src.tar.xz |
|
|
|
WORKDIR ./upx-${UPX_VERSION}-src/ |
|
|
|
RUN make -C ./src/ && mkdir -p /upx/bin/ && mv ./src/upx.out /upx/bin/upx && \ |
|
|
|
mkdir -p /upx/lib/ && cd /usr/lib/ && cp -d ./libgcc_s.so* ./libstdc++.so* ./libucl.so* /upx/lib/ |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN apk add git && /apk/setup |
|
|
|
RUN git clone https://github.com/dnomd343/upx.git |
|
|
|
WORKDIR ./upx/ |
|
|
|
RUN git submodule update --init && rm -rf ./.git/ |
|
|
|
RUN make UPX_CMAKE_CONFIG_FLAGS=-DCMAKE_EXE_LINKER_FLAGS=-static && \ |
|
|
|
mv ./build/release/upx /tmp/ && strip /tmp/upx |
|
|
|
|
|
|
|
# Compile shadowsocks-rust |
|
|
|
FROM ${RUST_IMG} AS ss-rust |
|
|
|
ENV SS_RUST="1.15.0-alpha.8" |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && \ |
|
|
|
wget https://github.com/shadowsocks/shadowsocks-rust/archive/refs/tags/v${SS_RUST}.tar.gz && tar xf v${SS_RUST}.tar.gz |
|
|
|
RUN wget https://github.com/shadowsocks/shadowsocks-rust/archive/refs/tags/v${SS_RUST}.tar.gz && \ |
|
|
|
tar xf v${SS_RUST}.tar.gz && /apk/setup |
|
|
|
WORKDIR ./shadowsocks-rust-${SS_RUST}/ |
|
|
|
RUN cargo fetch |
|
|
|
RUN cargo build --target-dir ./ --release --bin sslocal --bin ssserver \ |
|
|
|
--features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra" && \ |
|
|
|
mv ./release/sslocal /tmp/ss-rust-local && mv ./release/ssserver /tmp/ss-rust-server && strip /tmp/ss-rust-* |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
cd ./release/ && strip sslocal ssserver && mv sslocal ssserver /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN ls /tmp/ss-rust-* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile shadowsocks-libev |
|
|
@ -63,53 +64,56 @@ FROM ${ALPINE_IMG} AS ss-libev |
|
|
|
ENV SS_LIBEV="3.3.5" |
|
|
|
RUN apk add c-ares-dev libev-dev libsodium-dev linux-headers mbedtls-dev pcre-dev |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && \ |
|
|
|
wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SS_LIBEV}/shadowsocks-libev-${SS_LIBEV}.tar.gz && tar xf shadowsocks-libev-*.tar.gz |
|
|
|
RUN wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SS_LIBEV}/shadowsocks-libev-${SS_LIBEV}.tar.gz && \ |
|
|
|
tar xf shadowsocks-libev-*.tar.gz && /apk/setup |
|
|
|
WORKDIR ./shadowsocks-libev-${SS_LIBEV}/ |
|
|
|
RUN ./configure --disable-documentation && make && \ |
|
|
|
mv ./src/ss-local /tmp/ss-libev-local && mv ./src/ss-server /tmp/ss-libev-server && strip /tmp/ss-libev-* |
|
|
|
RUN ./configure --disable-documentation && \ |
|
|
|
make && cd ./src/ && strip ss-local ss-server && \ |
|
|
|
mv ss-local /tmp/ss-libev-local && mv ss-server /tmp/ss-libev-server |
|
|
|
|
|
|
|
# Package shadowsocks-python (lastest version, legacy version, R version aka ssr) |
|
|
|
FROM ${PYTHON_IMG} AS ss-python |
|
|
|
ENV SS_PYTHON_LEGACY="2.6.2" |
|
|
|
RUN apk add git && mkdir /packages/ && \ |
|
|
|
git clone https://github.com/dnomd343/shadowsocksr.git && \ |
|
|
|
ENV SS_PYTHON="2.6.2" |
|
|
|
RUN apk add git && mkdir -p /packages/ |
|
|
|
RUN git clone https://github.com/dnomd343/shadowsocksr.git && \ |
|
|
|
git clone https://github.com/shadowsocks/shadowsocks.git && \ |
|
|
|
wget https://github.com/shadowsocks/shadowsocks/archive/refs/tags/${SS_PYTHON_LEGACY}.tar.gz && tar xf ${SS_PYTHON_LEGACY}.tar.gz |
|
|
|
wget https://github.com/shadowsocks/shadowsocks/archive/refs/tags/${SS_PYTHON}.tar.gz && tar xf ${SS_PYTHON}.tar.gz |
|
|
|
# shadowsocks-python (R version) |
|
|
|
WORKDIR ./shadowsocksr/ |
|
|
|
WORKDIR /shadowsocksr/ |
|
|
|
RUN sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ |
|
|
|
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/ordereddict.py && \ |
|
|
|
sed -i "s/find_library(p)/'libcrypto.so.1.0.0'/g" ./shadowsocks/crypto/ctypes_openssl.py && \ |
|
|
|
sed -i "/for path in paths:/a\ if 'libcrypto.so' in path:" ./shadowsocks/crypto/util.py && \ |
|
|
|
sed -i "/libcrypto.so/a\ path = 'libcrypto.so.1.0.0'" ./shadowsocks/crypto/util.py && \ |
|
|
|
python3 setup.py build && cd ./build/lib/shadowsocks/ && chmod +x ./local.py ./server.py && \ |
|
|
|
mv ./local.py ./server.py ../ && mv ../../lib/ /packages/ssr-python/ |
|
|
|
python3 setup.py build |
|
|
|
WORKDIR ./build/lib/shadowsocks/ |
|
|
|
RUN chmod +x local.py server.py && mv local.py server.py ../ && mv ../../lib/ /packages/ssr-python/ |
|
|
|
# shadowsocks-python (latest version) |
|
|
|
WORKDIR ../shadowsocks/ |
|
|
|
WORKDIR /shadowsocks/ |
|
|
|
RUN git checkout master && \ |
|
|
|
sed -i 's/if addr is/if addr ==/g' ./shadowsocks/common.py && \ |
|
|
|
sed -i 's/and ip is not/and ip !=/g' ./shadowsocks/common.py && \ |
|
|
|
sed -i 's/if len(block) is/if len(block) ==/g' ./shadowsocks/common.py && \ |
|
|
|
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ |
|
|
|
python3 setup.py build && cd ./build/lib/shadowsocks/ && chmod +x ./local.py ./server.py && \ |
|
|
|
mv ./local.py ./server.py ../ && mv ../../lib/ /packages/ss-python/ |
|
|
|
python3 setup.py build |
|
|
|
WORKDIR ./build/lib/shadowsocks/ |
|
|
|
RUN chmod +x local.py server.py && mv local.py server.py ../ && mv ../../lib/ /packages/ss-python/ |
|
|
|
# shadowsocks-python (legacy version) |
|
|
|
WORKDIR ../shadowsocks-${SS_PYTHON_LEGACY}/ |
|
|
|
WORKDIR /shadowsocks-${SS_PYTHON}/ |
|
|
|
RUN sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ |
|
|
|
sed -i "s/find_library(p)/'libsodium.so.23'/g" ./shadowsocks/crypto/ctypes_libsodium.py && \ |
|
|
|
sed -i "s/find_library(p)/'libcrypto.so.1.0.0'/g" ./shadowsocks/crypto/ctypes_openssl.py && \ |
|
|
|
python3 setup.py build && cd ./build/lib/shadowsocks/ && chmod +x ./local.py ./server.py && \ |
|
|
|
mv ./local.py ./server.py ../ && mv ../../lib/ /packages/ss-python-legacy/ |
|
|
|
python3 setup.py build |
|
|
|
WORKDIR ./build/lib/shadowsocks/ |
|
|
|
RUN chmod +x local.py server.py && mv local.py server.py ../ && mv ../../lib/ /packages/ss-python-legacy/ |
|
|
|
|
|
|
|
# Compile shadowsocks-bootstrap |
|
|
|
FROM ${ALPINE_IMG} AS ss-bootstrap |
|
|
|
RUN apk add cmake git |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && /apk/build-base |
|
|
|
WORKDIR ./shadowsocks-bootstrap/build/ |
|
|
|
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && make && \ |
|
|
|
mv ../bin/ss-bootstrap-* /tmp/ && strip /tmp/ss-bootstrap-* |
|
|
|
RUN git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && /apk/setup |
|
|
|
WORKDIR ./shadowsocks-bootstrap/bin/ |
|
|
|
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && make && strip ss-bootstrap-* && mv ss-bootstrap-* /tmp/ |
|
|
|
|
|
|
|
# Combine shadowsocks dependencies |
|
|
|
FROM ${PYTHON_IMG} AS shadowsocks |
|
|
@ -129,45 +133,46 @@ FROM ${ALPINE_IMG} AS python-pkg |
|
|
|
COPY --from=wheels /wheels/*.whl /site-packages/ |
|
|
|
COPY --from=ss-python /packages/ /site-packages/ |
|
|
|
WORKDIR /site-packages/ |
|
|
|
RUN ls ./*.whl | xargs -n1 unzip && rm ./*.whl && \ |
|
|
|
RUN ls *.whl | xargs -n1 unzip && rm *.whl && \ |
|
|
|
rm -rf $(find ./ -name '__pycache__') && tar czf /packages.tar.gz ./ |
|
|
|
|
|
|
|
# Compile openssl (old version, for shadowsocks method -> idea-cfb / seed-cfb) |
|
|
|
FROM ${ALPINE_IMG} AS openssl |
|
|
|
ENV OPENSSL_VER="1.0.2" |
|
|
|
ENV OPENSSL_SUB_VER="u" |
|
|
|
ENV OPENSSL="1.0.2" |
|
|
|
ENV OPENSSL_SUB="u" |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN apk add perl && /apk/build-base && \ |
|
|
|
wget https://www.openssl.org/source/old/${OPENSSL_VER}/openssl-${OPENSSL_VER}${OPENSSL_SUB_VER}.tar.gz && tar xf openssl-*.tar.gz |
|
|
|
WORKDIR ./openssl-${OPENSSL_VER}${OPENSSL_SUB_VER}/ |
|
|
|
RUN apk add perl && wget https://www.openssl.org/source/old/${OPENSSL}/openssl-${OPENSSL}${OPENSSL_SUB}.tar.gz && \ |
|
|
|
tar xf openssl-*.tar.gz && /apk/setup |
|
|
|
WORKDIR ./openssl-${OPENSSL}${OPENSSL_SUB}/ |
|
|
|
RUN ./config --shared --prefix=/usr && make && \ |
|
|
|
mv ./libcrypto.so.1.0.0 /tmp/ && strip /tmp/libcrypto.so.1.0.0 |
|
|
|
strip libcrypto.so.1.0.0 && mv libcrypto.so.1.0.0 /tmp/ |
|
|
|
|
|
|
|
# Compile sip003 plugins (part1 -> gcc & cargo) |
|
|
|
FROM ${RUST_IMG} AS plugin-1 |
|
|
|
RUN apk add autoconf automake git libev-dev libtool linux-headers |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && mkdir -p /plugins/ && \ |
|
|
|
git clone https://github.com/shadowsocks/qtun.git && \ |
|
|
|
git clone https://github.com/shadowsocks/simple-obfs.git |
|
|
|
RUN git clone https://github.com/shadowsocks/qtun.git && \ |
|
|
|
git clone https://github.com/shadowsocks/simple-obfs.git && \ |
|
|
|
/apk/setup && mkdir -p /plugins/ |
|
|
|
# Compile simple-obfs |
|
|
|
WORKDIR ./simple-obfs/ |
|
|
|
WORKDIR /simple-obfs/ |
|
|
|
RUN git submodule update --init --recursive && ./autogen.sh && \ |
|
|
|
./configure --disable-documentation && make && mv ./src/obfs-local ./src/obfs-server /plugins/ |
|
|
|
./configure --disable-documentation && make && cd ./src/ && \ |
|
|
|
strip obfs-local obfs-server && mv obfs-local obfs-server /plugins/ |
|
|
|
# Compile qtun |
|
|
|
WORKDIR ../qtun/ |
|
|
|
WORKDIR /qtun/ |
|
|
|
RUN cargo fetch |
|
|
|
RUN cargo build --target-dir ./ --release && \ |
|
|
|
mv ./release/qtun-client ./release/qtun-server /plugins/ && strip /plugins/* |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
RUN cargo build --target-dir ./ --release && cd ./release/ && \ |
|
|
|
strip qtun-client qtun-server && mv qtun-client qtun-server /plugins/ |
|
|
|
COPY --from=upx /usr/upx /usr/bin/ |
|
|
|
RUN ls /plugins/qtun-* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile sip003 plugins (part2 -> go1.16) |
|
|
|
FROM ${GO16_IMG} AS plugin-2 |
|
|
|
ENV GOST_PLUGIN="v1.6.3" |
|
|
|
RUN apk add git && mkdir /plugins/ |
|
|
|
ENV V2RAY_PLUGIN="v1.3.2" |
|
|
|
RUN apk add git && mkdir -p /plugins/ |
|
|
|
RUN git clone https://github.com/Qv2ray/gun.git && \ |
|
|
|
git clone https://github.com/dnomd343/kcptun.git && \ |
|
|
|
git clone https://github.com/dnomd343/GoQuiet.git && \ |
|
|
|
git clone https://github.com/ihciah/rabbit-tcp.git && \ |
|
|
|
git clone https://github.com/dnomd343/rabbit-plugin.git && \ |
|
|
@ -175,76 +180,76 @@ RUN git clone https://github.com/Qv2ray/gun.git && \ |
|
|
|
git clone https://github.com/shadowsocks/v2ray-plugin.git && \ |
|
|
|
git clone https://github.com/IrineSistiana/mos-tls-tunnel.git |
|
|
|
# Compile v2ray-plugin |
|
|
|
WORKDIR ./v2ray-plugin/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && mv ./v2ray-plugin /plugins/ |
|
|
|
# Compile kcptun |
|
|
|
WORKDIR ../kcptun/ |
|
|
|
RUN git checkout sip003 && \ |
|
|
|
go mod init github.com/shadowsocks/kcptun && go mod tidy |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o kcptun-client -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./client && \ |
|
|
|
env CGO_ENABLED=0 go build -v -o kcptun-server -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./server && \ |
|
|
|
mv ./kcptun-client ./kcptun-server /plugins/ |
|
|
|
WORKDIR /go/v2ray-plugin/ |
|
|
|
RUN git checkout ${V2RAY_PLUGIN} && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && \ |
|
|
|
mv v2ray-plugin /plugins/ |
|
|
|
# Compile gost-plugin |
|
|
|
WORKDIR ../gost-plugin/ |
|
|
|
RUN git checkout ${GOST_PLUGIN} && go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && mv ./gost-plugin /plugins/ |
|
|
|
WORKDIR /go/gost-plugin/ |
|
|
|
RUN git checkout ${GOST_PLUGIN} && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && \ |
|
|
|
mv gost-plugin /plugins/ |
|
|
|
# Compile GoQuiet |
|
|
|
WORKDIR ../GoQuiet/ |
|
|
|
RUN go mod init github.com/cbeuw/GoQuiet |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-client && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-server && \ |
|
|
|
mv ./gq-client ./gq-server /plugins/ |
|
|
|
WORKDIR /go/GoQuiet/ |
|
|
|
RUN go mod init github.com/cbeuw/GoQuiet && go mod tidy |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-client/ && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-server/ && \ |
|
|
|
mv gq-client gq-server /plugins/ |
|
|
|
# Compile mos-tls-tunnel |
|
|
|
WORKDIR ../mos-tls-tunnel/ |
|
|
|
WORKDIR /go/mos-tls-tunnel/ |
|
|
|
RUN go mod init github.com/IrineSistiana/mos-tls-tunnel && go mod vendor |
|
|
|
RUN env CGO_ENABLED=0 go build -v -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-client && \ |
|
|
|
env CGO_ENABLED=0 go build -v -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-server && \ |
|
|
|
mv ./mtt-client ./mtt-server /plugins/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-client/ && \ |
|
|
|
env CGO_ENABLED=0 go build -v -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-server/ && \ |
|
|
|
mv mtt-client mtt-server /plugins/ |
|
|
|
# Compile rabbit-plugin |
|
|
|
WORKDIR ../rabbit-plugin/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv ./rabbit-plugin /plugins/ |
|
|
|
WORKDIR /go/rabbit-plugin/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv rabbit-plugin /plugins/ |
|
|
|
# Compile rabbit-tcp |
|
|
|
WORKDIR ../rabbit-tcp/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.Version=$(git describe --tags) -s -w" ./cmd/rabbit.go && mv ./rabbit /plugins/ |
|
|
|
WORKDIR /go/rabbit-tcp/cmd/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.Version=$(git describe --tags) -s -w" && \ |
|
|
|
mv cmd /plugins/rabbit |
|
|
|
# Compile gun-plugin |
|
|
|
WORKDIR ../gun/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o gun-plugin -trimpath -ldflags "-s -w" ./cmd/sip003/ && mv ./gun-plugin /plugins/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
WORKDIR /go/gun/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" ./cmd/sip003/ && mv sip003 /plugins/gun-plugin |
|
|
|
COPY --from=upx /tmp/upx/ /usr/bin/ |
|
|
|
RUN ls /plugins/* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile sip003 plugins (part3 -> go1.17) |
|
|
|
FROM ${GO17_IMG} AS plugin-3 |
|
|
|
ENV SIMPLE_TLS="v0.7.0" |
|
|
|
ENV CLOAK="v2.6.0" |
|
|
|
RUN apk add git && mkdir /plugins/ |
|
|
|
RUN apk add git && mkdir -p /plugins/ |
|
|
|
RUN git clone https://github.com/cbeuw/Cloak.git && \ |
|
|
|
git clone https://github.com/IrineSistiana/simple-tls.git |
|
|
|
# Compile simple-tls |
|
|
|
WORKDIR ./simple-tls/ |
|
|
|
RUN git checkout ${SIMPLE_TLS} && go mod download -x |
|
|
|
RUN sed -i 's/version = "unknown\/dev"/version = "'$(git describe --tags)'"/g' main.go && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv ./simple-tls /plugins/ |
|
|
|
WORKDIR /go/simple-tls/ |
|
|
|
RUN git checkout ${SIMPLE_TLS} && \ |
|
|
|
sed -i 's/version = "unknown\/dev"/version = "'$(git describe --tags)'"/g' main.go && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv simple-tls /plugins/ |
|
|
|
# Compile Cloak |
|
|
|
WORKDIR ../Cloak/ |
|
|
|
RUN git checkout ${CLOAK} && go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-client && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-server && \ |
|
|
|
mv ./ck-client ./ck-server /plugins/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
WORKDIR /go/Cloak/ |
|
|
|
RUN git checkout ${CLOAK} && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-client/ && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-server/ && \ |
|
|
|
mv ck-client ck-server /plugins/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN ls /plugins/* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile sip003 plugins (part4 -> go1.18) |
|
|
|
FROM ${GO18_IMG} AS plugin-4 |
|
|
|
RUN apk add git && mkdir /plugins/ |
|
|
|
RUN git clone https://github.com/teddysun/xray-plugin.git |
|
|
|
RUN apk add git && mkdir -p /plugins/ |
|
|
|
RUN git clone https://github.com/dnomd343/kcptun.git && \ |
|
|
|
git clone https://github.com/teddysun/xray-plugin.git |
|
|
|
# Compile xray-plugin |
|
|
|
WORKDIR ./xray-plugin/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && mv ./xray-plugin /plugins/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
WORKDIR /go/xray-plugin/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && mv xray-plugin /plugins/ |
|
|
|
# Compile kcptun |
|
|
|
WORKDIR /go/kcptun/ |
|
|
|
RUN git checkout sip003 && go mod init github.com/shadowsocks/kcptun && go mod tidy |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o kcptun-client -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./client/ && \ |
|
|
|
env CGO_ENABLED=0 go build -v -o kcptun-server -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./server/ && \ |
|
|
|
mv kcptun-client kcptun-server /plugins/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN ls /plugins/* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Combine sip003 plugins |
|
|
@ -255,105 +260,95 @@ COPY --from=plugin-3 /plugins/ /plugins/ |
|
|
|
COPY --from=plugin-4 /plugins/ /plugins/ |
|
|
|
|
|
|
|
# Compile xray-core |
|
|
|
FROM golang:1.18-alpine3.16 AS xray |
|
|
|
ENV XRAY_VERSION="1.5.10" |
|
|
|
RUN wget https://github.com/XTLS/Xray-core/archive/refs/tags/v${XRAY_VERSION}.tar.gz && tar xf v${XRAY_VERSION}.tar.gz |
|
|
|
WORKDIR ./Xray-core-${XRAY_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o xray -trimpath -ldflags "-s -w" ./main/ && mv ./xray /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
FROM ${GO19_IMG} AS xray |
|
|
|
ENV XRAY="1.6.0" |
|
|
|
RUN wget https://github.com/XTLS/Xray-core/archive/refs/tags/v${XRAY}.tar.gz && tar xf v${XRAY}.tar.gz |
|
|
|
WORKDIR ./Xray-core-${XRAY}/main/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv main /tmp/xray |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/xray |
|
|
|
|
|
|
|
# Compile v2ray-core |
|
|
|
FROM golang:1.18-alpine3.16 AS v2ray |
|
|
|
ENV V2FLY_VERSION="4.45.2" |
|
|
|
RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY_VERSION}.tar.gz && tar xf v${V2FLY_VERSION}.tar.gz |
|
|
|
WORKDIR ./v2ray-core-${V2FLY_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o v2ray -trimpath -ldflags "-s -w" ./main/ && mv ./v2ray /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
FROM ${GO19_IMG} AS v2ray |
|
|
|
ENV V2FLY="5.1.0" |
|
|
|
RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY}.tar.gz && tar xf v${V2FLY}.tar.gz |
|
|
|
WORKDIR ./v2ray-core-${V2FLY}/main/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv main /tmp/v2ray |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/v2ray |
|
|
|
|
|
|
|
# Compile v2ray-core (Sagernet version) |
|
|
|
FROM golang:1.18-alpine3.16 AS sagray |
|
|
|
ENV SAGER_VERSION="5.0.16" |
|
|
|
RUN wget https://github.com/SagerNet/v2ray-core/archive/refs/tags/v${SAGER_VERSION}.tar.gz && tar xf v${SAGER_VERSION}.tar.gz |
|
|
|
WORKDIR ./v2ray-core-${SAGER_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o sagray -trimpath -ldflags "-s -w" ./main/ && mv ./sagray /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
RUN upx -9 /tmp/sagray |
|
|
|
|
|
|
|
# Compile trojan-go |
|
|
|
FROM ${GO17_IMG} AS trojan-go |
|
|
|
ENV TROJAN_GO_VERSION="v0.10.6" |
|
|
|
ENV TROJAN_GO="v0.10.6" |
|
|
|
RUN apk add git && git clone https://github.com/p4gefau1t/trojan-go.git |
|
|
|
WORKDIR ./trojan-go/ |
|
|
|
RUN git checkout ${TROJAN_GO_VERSION} && go mod download -x |
|
|
|
RUN git checkout ${TROJAN_GO} && go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -tags "full" -trimpath -ldflags " \ |
|
|
|
-X github.com/p4gefau1t/trojan-go/constant.Version=$(git describe --dirty) \ |
|
|
|
-X github.com/p4gefau1t/trojan-go/constant.Commit=$(git rev-parse HEAD) -s -w" && \ |
|
|
|
mv ./trojan-go /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
mv trojan-go /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/trojan-go |
|
|
|
|
|
|
|
# Compile trojan |
|
|
|
FROM ${ALPINE_IMG} AS trojan |
|
|
|
ENV TROJAN_VERSION="1.16.0" |
|
|
|
ENV TROJAN="1.16.0" |
|
|
|
RUN apk add boost-dev cmake openssl-dev |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN /apk/build-base && \ |
|
|
|
wget https://github.com/trojan-gfw/trojan/archive/refs/tags/v${TROJAN_VERSION}.tar.gz && tar xf v${TROJAN_VERSION}.tar.gz |
|
|
|
WORKDIR ./trojan-${TROJAN_VERSION}/build/ |
|
|
|
RUN cmake .. -DENABLE_MYSQL=OFF -DSYSTEMD_SERVICE=OFF && make && mv ./trojan /tmp/ && strip /tmp/trojan |
|
|
|
RUN wget https://github.com/trojan-gfw/trojan/archive/refs/tags/v${TROJAN}.tar.gz && \ |
|
|
|
tar xf v${TROJAN}.tar.gz && /apk/setup |
|
|
|
WORKDIR ./trojan-${TROJAN}/build/ |
|
|
|
RUN cmake .. -DENABLE_MYSQL=OFF -DSYSTEMD_SERVICE=OFF && make && strip trojan && mv trojan /tmp/ |
|
|
|
COPY --from=trojan-go /tmp/trojan-go /tmp/ |
|
|
|
|
|
|
|
# Compile gost and gost-v3 |
|
|
|
FROM ${GO19_IMG} AS gost |
|
|
|
ENV GOST_VERSION="2.11.3" |
|
|
|
ENV GOST_V3_VERSION="3.0.0-beta.4" |
|
|
|
ENV GOST="2.11.4" |
|
|
|
ENV GOST_V3="3.0.0-beta.5" |
|
|
|
RUN apk add git |
|
|
|
RUN wget https://github.com/ginuerzh/gost/archive/refs/tags/v${GOST_VERSION}.tar.gz && tar xf v${GOST_VERSION}.tar.gz && \ |
|
|
|
wget https://github.com/go-gost/gost/archive/refs/tags/v${GOST_V3_VERSION}.tar.gz && tar xf v${GOST_V3_VERSION}.tar.gz |
|
|
|
WORKDIR ./gost-${GOST_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" ./cmd/gost && mv ./gost /tmp/ |
|
|
|
WORKDIR ../gost-${GOST_V3_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" ./cmd/gost && mv ./gost /tmp/gost-v3 |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
RUN wget https://github.com/ginuerzh/gost/archive/refs/tags/v${GOST}.tar.gz && tar xf v${GOST}.tar.gz && \ |
|
|
|
wget https://github.com/go-gost/gost/archive/refs/tags/v${GOST_V3}.tar.gz && tar xf v${GOST_V3}.tar.gz |
|
|
|
WORKDIR /go/gost-${GOST}/cmd/gost/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv gost /tmp/ |
|
|
|
WORKDIR /go/gost-${GOST_V3}/cmd/gost/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv gost /tmp/gost-v3 |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN ls /tmp/gost* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile brook |
|
|
|
FROM ${GO16_IMG} AS brook |
|
|
|
ENV BROOK_VERSION="20220707" |
|
|
|
RUN wget https://github.com/txthinking/brook/archive/refs/tags/v${BROOK_VERSION}.tar.gz && tar xf v${BROOK_VERSION}.tar.gz |
|
|
|
WORKDIR ./brook-${BROOK_VERSION}/ |
|
|
|
ENV BROOK="20221010" |
|
|
|
RUN wget https://github.com/txthinking/brook/archive/refs/tags/v${BROOK}.tar.gz && tar xf v${BROOK}.tar.gz |
|
|
|
WORKDIR ./brook-${BROOK}/cli/brook/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" ./cli/brook && mv ./brook /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv brook /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/brook |
|
|
|
|
|
|
|
# Compile clash |
|
|
|
FROM ${GO19_IMG} AS clash |
|
|
|
ENV CLASH_VERSION="1.11.8" |
|
|
|
RUN wget https://github.com/Dreamacro/clash/archive/refs/tags/v${CLASH_VERSION}.tar.gz && tar xf v${CLASH_VERSION}.tar.gz |
|
|
|
WORKDIR ./clash-${CLASH_VERSION}/ |
|
|
|
ENV CLASH="1.11.8" |
|
|
|
RUN wget https://github.com/Dreamacro/clash/archive/refs/tags/v${CLASH}.tar.gz && tar xf v${CLASH}.tar.gz |
|
|
|
WORKDIR ./clash-${CLASH}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w \ |
|
|
|
-X 'github.com/Dreamacro/clash/constant.Version=${CLASH_VERSION}' \ |
|
|
|
-X 'github.com/Dreamacro/clash/constant.Version=${CLASH}' \ |
|
|
|
-X 'github.com/Dreamacro/clash/constant.BuildTime=$(date -u)'" && \ |
|
|
|
mv ./clash /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
mv clash /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/clash |
|
|
|
|
|
|
|
# Download naiveproxy |
|
|
|
FROM ${ALPINE_IMG} AS naive |
|
|
|
ENV NAIVE_VERSION="v105.0.5195.52-1" |
|
|
|
ENV NAIVE="v106.0.5249.91-1" |
|
|
|
COPY --from=build-base /apk/ /apk/ |
|
|
|
RUN apk add curl libgcc jq && /apk/build-base |
|
|
|
RUN curl -sL https://api.github.com/repos/klzgrad/naiveproxy/releases/tags/${NAIVE_VERSION} \ |
|
|
|
| jq .assets | jq .[].name | grep naiveproxy-${NAIVE_VERSION}-openwrt-$(uname -m) \ |
|
|
|
RUN apk add curl libgcc jq && /apk/setup |
|
|
|
RUN curl -sL https://api.github.com/repos/klzgrad/naiveproxy/releases/tags/${NAIVE} \ |
|
|
|
| jq .assets | jq .[].name | grep naiveproxy-${NAIVE}-openwrt-$(uname -m) \ |
|
|
|
| cut -b 2- | rev | cut -b 2- | rev | tac > list.dat |
|
|
|
RUN echo "while read FILE_NAME; do" >> naive.sh && \ |
|
|
|
echo "wget https://github.com/klzgrad/naiveproxy/releases/download/\${NAIVE_VERSION}/\${FILE_NAME}" >> naive.sh && \ |
|
|
@ -363,92 +358,90 @@ RUN echo "while read FILE_NAME; do" >> naive.sh && \ |
|
|
|
|
|
|
|
# Compile open-snell |
|
|
|
FROM ${GO17_IMG} AS snell |
|
|
|
ENV SNELL_VERSION="3.0.1" |
|
|
|
RUN wget https://github.com/icpz/open-snell/archive/refs/tags/v${SNELL_VERSION}.tar.gz && tar xf v${SNELL_VERSION}.tar.gz |
|
|
|
WORKDIR ./open-snell-${SNELL_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
ENV SNELL="3.0.1" |
|
|
|
RUN wget https://github.com/icpz/open-snell/archive/refs/tags/v${SNELL}.tar.gz && tar xf v${SNELL}.tar.gz |
|
|
|
WORKDIR ./open-snell-${SNELL}/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags \ |
|
|
|
"-s -w -X 'github.com/icpz/open-snell/constants.Version=${SNELL_VERSION}'" ./cmd/snell-client && \ |
|
|
|
"-s -w -X 'github.com/icpz/open-snell/constants.Version=${SNELL}'" ./cmd/snell-client/ && \ |
|
|
|
env CGO_ENABLED=0 go build -v -trimpath -ldflags \ |
|
|
|
"-s -w -X 'github.com/icpz/open-snell/constants.Version=${SNELL_VERSION}'" ./cmd/snell-server && \ |
|
|
|
mv ./snell-client ./snell-server /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
"-s -w -X 'github.com/icpz/open-snell/constants.Version=${SNELL}'" ./cmd/snell-server/ && \ |
|
|
|
mv snell-client snell-server /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN ls /tmp/snell-* | xargs -P0 -n1 upx -9 |
|
|
|
|
|
|
|
# Compile hysteria |
|
|
|
FROM ${GO19_IMG} AS hysteria |
|
|
|
ENV HYSTERIA_VERSION="v1.2.0" |
|
|
|
ENV HYSTERIA="v1.2.1" |
|
|
|
RUN apk add git |
|
|
|
RUN git clone https://github.com/HyNetwork/hysteria.git |
|
|
|
WORKDIR ./hysteria/ |
|
|
|
RUN git checkout ${HYSTERIA_VERSION} && go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -o hysteria -trimpath -ldflags "-s -w \ |
|
|
|
WORKDIR ./hysteria/cmd/ |
|
|
|
RUN git checkout ${HYSTERIA} && go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w \ |
|
|
|
-X 'main.appVersion=$(git describe --tags)' \ |
|
|
|
-X 'main.appCommit=$(git rev-parse HEAD)' \ |
|
|
|
-X 'main.appDate=$(date "+%F %T")'" ./cmd && \ |
|
|
|
mv ./hysteria /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
-X 'main.appDate=$(date "+%F %T")'" && \ |
|
|
|
mv cmd /tmp/hysteria |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/hysteria |
|
|
|
|
|
|
|
# Compile relaybaton |
|
|
|
FROM ${GO14_IMG} AS relaybaton |
|
|
|
ENV RELAYBATON_VERSION="0.6.0" |
|
|
|
ENV RELAYBATON="0.6.0" |
|
|
|
RUN apk add build-base git perl rsync |
|
|
|
RUN wget https://github.com/iyouport-org/relaybaton/archive/refs/tags/v${RELAYBATON_VERSION}.tar.gz && tar xf v${RELAYBATON_VERSION}.tar.gz |
|
|
|
WORKDIR ./relaybaton-${RELAYBATON_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN wget https://github.com/iyouport-org/relaybaton/archive/refs/tags/v${RELAYBATON}.tar.gz && tar xf v${RELAYBATON}.tar.gz |
|
|
|
WORKDIR ./relaybaton-${RELAYBATON}/ |
|
|
|
RUN go get -d |
|
|
|
RUN make && mv ./bin/relaybaton /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
RUN upx -9 /tmp/relaybaton |
|
|
|
|
|
|
|
# Compile dnsproxy |
|
|
|
FROM ${GO18_IMG} AS dnsproxy |
|
|
|
ENV DNSPROXY_VERSION="0.44.0" |
|
|
|
RUN wget https://github.com/AdguardTeam/dnsproxy/archive/refs/tags/v${DNSPROXY_VERSION}.tar.gz && tar xf v${DNSPROXY_VERSION}.tar.gz |
|
|
|
WORKDIR ./dnsproxy-${DNSPROXY_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DNSPROXY_VERSION} -s -w" && mv ./dnsproxy /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
ENV DNSPROXY="0.45.2" |
|
|
|
RUN wget https://github.com/AdguardTeam/dnsproxy/archive/refs/tags/v${DNSPROXY}.tar.gz && tar xf v${DNSPROXY}.tar.gz |
|
|
|
WORKDIR ./dnsproxy-${DNSPROXY}/ |
|
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DNSPROXY} -s -w" && mv dnsproxy /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/dnsproxy |
|
|
|
|
|
|
|
# Compile mad |
|
|
|
FROM ${GO16_IMG} AS mad |
|
|
|
ENV MAD_VERSION="20210401" |
|
|
|
RUN wget https://github.com/txthinking/mad/archive/refs/tags/v${MAD_VERSION}.tar.gz && tar xf v${MAD_VERSION}.tar.gz |
|
|
|
WORKDIR ./mad-${MAD_VERSION}/ |
|
|
|
RUN go mod download -x |
|
|
|
RUN env CGO_ENABLED=0 go build -v -ldflags="-s -w" ./cli/mad && mv ./mad /tmp/ |
|
|
|
COPY --from=upx /upx/ /usr/ |
|
|
|
ENV MAD="20210401" |
|
|
|
RUN wget https://github.com/txthinking/mad/archive/refs/tags/v${MAD}.tar.gz && tar xf v${MAD}.tar.gz |
|
|
|
WORKDIR ./mad-${MAD}/cli/mad/ |
|
|
|
RUN go get -d |
|
|
|
RUN env CGO_ENABLED=0 go build -v -ldflags="-s -w" && mv mad /tmp/ |
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
|
RUN upx -9 /tmp/mad |
|
|
|
|
|
|
|
# Combine all release |
|
|
|
FROM ${PYTHON_IMG} AS asset |
|
|
|
FROM ${PYTHON_IMG} AS build |
|
|
|
COPY --from=python-pkg /packages.tar.gz / |
|
|
|
ARG PYTHON="3.10" |
|
|
|
RUN mkdir -p /asset/usr/local/lib/python${PYTHON}/site-packages/ && \ |
|
|
|
tar xf /packages.tar.gz -C /asset/usr/local/lib/python${PYTHON}/site-packages/ |
|
|
|
COPY --from=openssl /tmp/libcrypto.so* /asset/lib/ |
|
|
|
COPY --from=shadowsocks /release/ /asset/usr/bin/ |
|
|
|
COPY --from=plugin /plugins/ /asset/usr/bin/ |
|
|
|
COPY --from=xray /tmp/xray /asset/usr/bin/ |
|
|
|
COPY --from=v2ray /tmp/v2ray /asset/usr/bin/ |
|
|
|
COPY --from=sagray /tmp/sagray /asset/usr/bin/ |
|
|
|
COPY --from=trojan /tmp/trojan* /asset/usr/bin/ |
|
|
|
COPY --from=gost /tmp/gost* /asset/usr/bin/ |
|
|
|
COPY --from=brook /tmp/brook /asset/usr/bin/ |
|
|
|
COPY --from=clash /tmp/clash /asset/usr/bin/ |
|
|
|
COPY --from=naive /tmp/naive /asset/usr/bin/ |
|
|
|
COPY --from=snell /tmp/snell-* /asset/usr/bin/ |
|
|
|
COPY --from=hysteria /tmp/hysteria /asset/usr/bin/ |
|
|
|
COPY --from=relaybaton /tmp/relaybaton /asset/usr/bin/ |
|
|
|
COPY --from=dnsproxy /tmp/dnsproxy /asset/usr/bin/ |
|
|
|
COPY --from=mad /tmp/mad /asset/usr/bin/ |
|
|
|
COPY . /asset/usr/local/share/ProxyC/ |
|
|
|
WORKDIR /release/usr/local/lib/python${PYTHON}/site-packages/ |
|
|
|
RUN tar xf /packages.tar.gz -C ./ |
|
|
|
COPY --from=openssl /tmp/libcrypto.so* /release/lib/ |
|
|
|
COPY --from=shadowsocks /release/ /release/usr/bin/ |
|
|
|
COPY --from=plugin /plugins/ /release/usr/bin/ |
|
|
|
COPY --from=xray /tmp/xray /release/usr/bin/ |
|
|
|
COPY --from=v2ray /tmp/v2ray /release/usr/bin/ |
|
|
|
COPY --from=trojan /tmp/trojan* /release/usr/bin/ |
|
|
|
COPY --from=gost /tmp/gost* /release/usr/bin/ |
|
|
|
COPY --from=brook /tmp/brook /release/usr/bin/ |
|
|
|
COPY --from=clash /tmp/clash /release/usr/bin/ |
|
|
|
COPY --from=naive /tmp/naive /release/usr/bin/ |
|
|
|
COPY --from=snell /tmp/snell-* /release/usr/bin/ |
|
|
|
COPY --from=hysteria /tmp/hysteria /release/usr/bin/ |
|
|
|
COPY --from=relaybaton /tmp/relaybaton /release/usr/bin/ |
|
|
|
COPY --from=dnsproxy /tmp/dnsproxy /release/usr/bin/ |
|
|
|
COPY --from=mad /tmp/mad /release/usr/bin/ |
|
|
|
COPY . /release/usr/local/share/ProxyC/ |
|
|
|
|
|
|
|
# Release docker image |
|
|
|
FROM ${PYTHON_IMG} |
|
|
|
RUN apk add --no-cache boost-program_options c-ares ca-certificates libev libsodium libstdc++ mbedtls pcre && \ |
|
|
|
ln -s /usr/local/share/ProxyC/Main.py /usr/bin/proxyc |
|
|
|
COPY --from=asset /asset / |
|
|
|
COPY --from=build /release/ / |
|
|
|
EXPOSE 7839 |
|
|
|
ENTRYPOINT ["proxyc"] |
|
|
|