Browse Source

build: update proxyc compile

dev
Dnomd343 2 years ago
parent
commit
78752c9d01
  1. 166
      Dockerfile

166
Dockerfile

@ -1,33 +1,32 @@
ARG ALPINE_IMG="alpine:3.16" ARG ALPINE="alpine:3.16"
ARG RUST_IMG="rust:1.64-alpine3.16" ARG RUST="rust:1.64-alpine3.16"
ARG GO14_IMG="golang:1.14-alpine3.13" ARG GO14="golang:1.14-alpine3.13"
ARG GO16_IMG="golang:1.16-alpine3.15" ARG GO16="golang:1.16-alpine3.15"
ARG GO17_IMG="golang:1.17-alpine3.16" ARG GO18="golang:1.18-alpine3.16"
ARG GO18_IMG="golang:1.18-alpine3.16" ARG GO19="golang:1.19-alpine3.16"
ARG GO19_IMG="golang:1.19-alpine3.16" ARG PYTHON="python:3.10-alpine3.16"
ARG PYTHON_IMG="python:3.10-alpine3.16"
# Download build-base # Download build-base
FROM ${ALPINE_IMG} AS build-base FROM ${ALPINE} AS build-base
WORKDIR /apk/ WORKDIR /apk/
RUN echo -e "cd \`dirname \$0\`\napk add --no-network \\" > setup && chmod +x setup && \ 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 apk update && apk fetch -R build-base cmake | grep -oE '\S+$' | awk '{print "./"$0".apk \\"}' >> setup
# Compile python3 module numpy # Compile python3 module numpy
FROM ${PYTHON_IMG} AS numpy FROM ${PYTHON} AS numpy
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
WORKDIR /wheels/ WORKDIR /wheels/
RUN /apk/setup && pip wheel numpy RUN /apk/setup && pip wheel numpy
# Compile python3 module gevent # Compile python3 module gevent
FROM ${PYTHON_IMG} AS gevent FROM ${PYTHON} AS gevent
RUN apk add libffi-dev RUN apk add libffi-dev
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
WORKDIR /wheels/ WORKDIR /wheels/
RUN /apk/setup && pip wheel gevent RUN /apk/setup && pip wheel gevent
# Build python3 wheels # Build python3 wheels
FROM ${PYTHON_IMG} AS wheels FROM ${PYTHON} AS wheels
RUN apk add linux-headers RUN apk add linux-headers
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
WORKDIR /wheels/ WORKDIR /wheels/
@ -36,7 +35,7 @@ COPY --from=gevent /wheels/*.whl /wheels/
COPY --from=numpy /wheels/*.whl /wheels/ COPY --from=numpy /wheels/*.whl /wheels/
# Compile upx # Compile upx
FROM ${ALPINE_IMG} AS upx FROM ${ALPINE} AS upx
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN apk add git && /apk/setup RUN apk add git && /apk/setup
RUN git clone https://github.com/dnomd343/upx.git RUN git clone https://github.com/dnomd343/upx.git
@ -46,33 +45,34 @@ RUN make UPX_CMAKE_CONFIG_FLAGS=-DCMAKE_EXE_LINKER_FLAGS=-static && \
mv ./build/release/upx /tmp/ && strip /tmp/upx mv ./build/release/upx /tmp/ && strip /tmp/upx
# Compile shadowsocks-rust # Compile shadowsocks-rust
FROM ${RUST_IMG} AS ss-rust FROM ${RUST} AS ss-rust
ENV SS_RUST="1.15.0-alpha.8" ENV SS_RUST="1.15.0-alpha.8"
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN wget https://github.com/shadowsocks/shadowsocks-rust/archive/refs/tags/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 tar xf v${SS_RUST}.tar.gz && /apk/setup
WORKDIR ./shadowsocks-rust-${SS_RUST}/ WORKDIR ./shadowsocks-rust-${SS_RUST}/
RUN cargo fetch RUN cargo fetch
RUN cargo build --target-dir ./ --release --bin sslocal --bin ssserver \ RUN cargo build --release --bin sslocal --bin ssserver \
--features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra" && \ --features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra"
cd ./release/ && strip sslocal ssserver && mv sslocal ssserver /tmp/ WORKDIR ./target/release/
RUN mv sslocal /tmp/ss-rust-local && mv ssserver /tmp/ss-rust-server && strip /tmp/ss-rust-*
COPY --from=upx /tmp/upx /usr/bin/ COPY --from=upx /tmp/upx /usr/bin/
RUN ls /tmp/ss-rust-* | xargs -P0 -n1 upx -9 RUN ls /tmp/ss-rust-* | xargs -P0 -n1 upx -9
# Compile shadowsocks-libev # Compile shadowsocks-libev
FROM ${ALPINE_IMG} AS ss-libev FROM ${ALPINE} AS ss-libev
ENV SS_LIBEV="3.3.5" ENV SS_LIBEV="3.3.5"
RUN apk add c-ares-dev libev-dev libsodium-dev linux-headers mbedtls-dev pcre-dev RUN apk add c-ares-dev libev-dev libsodium-dev linux-headers mbedtls-dev pcre-dev
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SS_LIBEV}/shadowsocks-libev-${SS_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 tar xf shadowsocks-libev-*.tar.gz && /apk/setup
WORKDIR ./shadowsocks-libev-${SS_LIBEV}/ WORKDIR ./shadowsocks-libev-${SS_LIBEV}/
RUN ./configure --disable-documentation && \ RUN ./configure --disable-documentation && make
make && cd ./src/ && strip ss-local ss-server && \ WORKDIR ./src/
mv ss-local /tmp/ss-libev-local && mv ss-server /tmp/ss-libev-server RUN mv ss-local /tmp/ss-libev-local && mv ss-server /tmp/ss-libev-server && strip /tmp/ss-libev-*
# Package shadowsocks-python (lastest version, legacy version, R version aka ssr) # Package shadowsocks-python (lastest version, legacy version, R version aka ssr)
FROM ${PYTHON_IMG} AS ss-python FROM ${PYTHON} AS ss-python
ENV SS_PYTHON="2.6.2" ENV SS_PYTHON="2.6.2"
RUN apk add git && mkdir -p /packages/ RUN apk add git && mkdir -p /packages/
RUN git clone https://github.com/dnomd343/shadowsocksr.git && \ RUN git clone https://github.com/dnomd343/shadowsocksr.git && \
@ -82,7 +82,6 @@ RUN git clone https://github.com/dnomd343/shadowsocksr.git && \
WORKDIR /shadowsocksr/ WORKDIR /shadowsocksr/
RUN sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ RUN sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/ordereddict.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 "/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 && \ sed -i "/libcrypto.so/a\ path = 'libcrypto.so.1.0.0'" ./shadowsocks/crypto/util.py && \
python3 setup.py build python3 setup.py build
@ -108,15 +107,16 @@ WORKDIR ./build/lib/shadowsocks/
RUN chmod +x local.py server.py && mv local.py server.py ../ && mv ../../lib/ /packages/ss-python-legacy/ RUN chmod +x local.py server.py && mv local.py server.py ../ && mv ../../lib/ /packages/ss-python-legacy/
# Compile shadowsocks-bootstrap # Compile shadowsocks-bootstrap
FROM ${ALPINE_IMG} AS ss-bootstrap FROM ${ALPINE} AS ss-bootstrap
RUN apk add cmake git RUN apk add cmake git
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && /apk/setup RUN git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && /apk/setup
WORKDIR ./shadowsocks-bootstrap/bin/ WORKDIR ./shadowsocks-bootstrap/bin/
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && make && strip ss-bootstrap-* && mv ss-bootstrap-* /tmp/ RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_BUILD_TYPE=Release .. && \
make && strip ss-bootstrap-* && mv ss-bootstrap-* /tmp/
# Combine shadowsocks dependencies # Combine shadowsocks dependencies
FROM ${PYTHON_IMG} AS shadowsocks FROM ${PYTHON} AS shadowsocks
COPY --from=ss-rust /tmp/ss-rust-* /release/ COPY --from=ss-rust /tmp/ss-rust-* /release/
COPY --from=ss-libev /tmp/ss-libev-* /release/ COPY --from=ss-libev /tmp/ss-libev-* /release/
COPY --from=ss-bootstrap /tmp/ss-bootstrap-* /release/ COPY --from=ss-bootstrap /tmp/ss-bootstrap-* /release/
@ -129,26 +129,25 @@ RUN ln -s /usr/local/lib/python${PYTHON}/site-packages/ssr-python/local.py /rele
ln -s /usr/local/lib/python${PYTHON}/site-packages/ss-python-legacy/server.py /release/ss-python-legacy-server ln -s /usr/local/lib/python${PYTHON}/site-packages/ss-python-legacy/server.py /release/ss-python-legacy-server
# Pack python3 modules # Pack python3 modules
FROM ${ALPINE_IMG} AS python-pkg FROM ${ALPINE} AS python-pkg
COPY --from=wheels /wheels/*.whl /site-packages/ COPY --from=wheels /wheels/*.whl /site-packages/
COPY --from=ss-python /packages/ /site-packages/ COPY --from=ss-python /packages/ /site-packages/
WORKDIR /site-packages/ WORKDIR /site-packages/
RUN ls *.whl | xargs -n1 unzip && rm *.whl && \ RUN ls *.whl | xargs -P0 -n1 unzip && rm *.whl && \
rm -rf $(find ./ -name '__pycache__') && tar czf /packages.tar.gz ./ rm -rf $(find ./ -name '__pycache__') && tar czf /packages.tar.gz ./
# Compile openssl (old version, for shadowsocks method -> idea-cfb / seed-cfb) # Compile openssl (old version, for shadowsocks method -> idea-cfb / seed-cfb)
FROM ${ALPINE_IMG} AS openssl FROM ${ALPINE} AS openssl
ENV OPENSSL="1.0.2" ENV OPENSSL="1.0.2"
ENV OPENSSL_SUB="u" ENV OPENSSL_SUB="u"
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN apk add perl && wget https://www.openssl.org/source/old/${OPENSSL}/openssl-${OPENSSL}${OPENSSL_SUB}.tar.gz && \ RUN apk add perl && /apk/setup
tar xf openssl-*.tar.gz && /apk/setup RUN wget https://www.openssl.org/source/old/${OPENSSL}/openssl-${OPENSSL}${OPENSSL_SUB}.tar.gz && tar xf openssl-*.tar.gz
WORKDIR ./openssl-${OPENSSL}${OPENSSL_SUB}/ WORKDIR ./openssl-${OPENSSL}${OPENSSL_SUB}/
RUN ./config --shared --prefix=/usr && make && \ RUN ./config --shared --prefix=/usr/ && make && mv libcrypto.so.1.0.0 /tmp/ && strip /tmp/lib*
strip libcrypto.so.1.0.0 && mv libcrypto.so.1.0.0 /tmp/
# Compile sip003 plugins (part1 -> gcc & cargo) # Compile sip003 plugins (part1 -> gcc & cargo)
FROM ${RUST_IMG} AS plugin-1 FROM ${RUST} AS plugin-1
RUN apk add autoconf automake git libev-dev libtool linux-headers RUN apk add autoconf automake git libev-dev libtool linux-headers
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN git clone https://github.com/shadowsocks/qtun.git && \ RUN git clone https://github.com/shadowsocks/qtun.git && \
@ -156,24 +155,21 @@ RUN git clone https://github.com/shadowsocks/qtun.git && \
/apk/setup && mkdir -p /plugins/ /apk/setup && mkdir -p /plugins/
# Compile simple-obfs # Compile simple-obfs
WORKDIR /simple-obfs/ WORKDIR /simple-obfs/
RUN git submodule update --init --recursive && ./autogen.sh && \ RUN git submodule update --init && ./autogen.sh && ./configure --disable-documentation && \
./configure --disable-documentation && make && cd ./src/ && \ make && mv ./src/obfs-* /plugins/ && strip /plugins/obfs-*
strip obfs-local obfs-server && mv obfs-local obfs-server /plugins/
# Compile qtun # Compile qtun
WORKDIR /qtun/ WORKDIR /qtun/
RUN cargo fetch RUN cargo fetch
RUN cargo build --target-dir ./ --release && cd ./release/ && \ RUN cargo build --release && cd ./target/release/ && mv qtun-local qtun-server /plugins/ && strip /plugins/qtun-*
strip qtun-client qtun-server && mv qtun-client qtun-server /plugins/
COPY --from=upx /usr/upx /usr/bin/ COPY --from=upx /usr/upx /usr/bin/
RUN ls /plugins/qtun-* | xargs -P0 -n1 upx -9 RUN ls /plugins/qtun-* | xargs -P0 -n1 upx -9
# Compile sip003 plugins (part2 -> go1.16) # Compile sip003 plugins (part2 -> go1.16)
FROM ${GO16_IMG} AS plugin-2 FROM ${GO16} AS plugin-2
ENV GOST_PLUGIN="v1.6.3" ENV GOST_PLUGIN="v1.6.3"
ENV V2RAY_PLUGIN="v1.3.2" ENV V2RAY_PLUGIN="v1.3.2"
RUN apk add git && mkdir -p /plugins/ RUN apk add git && mkdir -p /plugins/
RUN git clone https://github.com/Qv2ray/gun.git && \ RUN git clone https://github.com/dnomd343/GoQuiet.git && \
git clone https://github.com/dnomd343/GoQuiet.git && \
git clone https://github.com/ihciah/rabbit-tcp.git && \ git clone https://github.com/ihciah/rabbit-tcp.git && \
git clone https://github.com/dnomd343/rabbit-plugin.git && \ git clone https://github.com/dnomd343/rabbit-plugin.git && \
git clone https://github.com/maskedeken/gost-plugin.git && \ git clone https://github.com/maskedeken/gost-plugin.git && \
@ -206,40 +202,25 @@ WORKDIR /go/rabbit-plugin/
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv rabbit-plugin /plugins/ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv rabbit-plugin /plugins/
# Compile rabbit-tcp # Compile rabbit-tcp
WORKDIR /go/rabbit-tcp/cmd/ WORKDIR /go/rabbit-tcp/cmd/
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.Version=$(git describe --tags) -s -w" && \ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.Version=$(git describe --tags) -s -w" && mv cmd /plugins/rabbit
mv cmd /plugins/rabbit
# Compile gun-plugin
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/ COPY --from=upx /tmp/upx/ /usr/bin/
RUN ls /plugins/* | xargs -P0 -n1 upx -9 RUN ls /plugins/* | xargs -P0 -n1 upx -9
# Compile sip003 plugins (part3 -> go1.17) # Compile sip003 plugins (part3 -> go1.18)
FROM ${GO17_IMG} AS plugin-3 FROM ${GO18} AS plugin-3
ENV SIMPLE_TLS="v0.7.0"
ENV CLOAK="v2.6.0" ENV CLOAK="v2.6.0"
ENV SIMPLE_TLS="v0.7.0"
RUN apk add git && mkdir -p /plugins/ RUN apk add git && mkdir -p /plugins/
RUN git clone https://github.com/cbeuw/Cloak.git && \ RUN git clone https://github.com/Qv2ray/gun.git && \
git clone https://github.com/cbeuw/Cloak.git && \
git clone https://github.com/dnomd343/kcptun.git && \
git clone https://github.com/teddysun/xray-plugin.git && \
git clone https://github.com/IrineSistiana/simple-tls.git git clone https://github.com/IrineSistiana/simple-tls.git
# Compile simple-tls # Compile simple-tls
WORKDIR /go/simple-tls/ WORKDIR /go/simple-tls/
RUN git checkout ${SIMPLE_TLS} && \ RUN git checkout ${SIMPLE_TLS} && \
sed -i 's/version = "unknown\/dev"/version = "'$(git describe --tags)'"/g' main.go && \ 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/ env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv simple-tls /plugins/
# Compile Cloak
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 -p /plugins/
RUN git clone https://github.com/dnomd343/kcptun.git && \
git clone https://github.com/teddysun/xray-plugin.git
# Compile xray-plugin # Compile xray-plugin
WORKDIR /go/xray-plugin/ 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/ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && mv xray-plugin /plugins/
@ -249,18 +230,26 @@ RUN git checkout sip003 && go mod init github.com/shadowsocks/kcptun && go mod t
RUN env CGO_ENABLED=0 go build -v -o kcptun-client -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./client/ && \ 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/ && \ 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/ mv kcptun-client kcptun-server /plugins/
# Compile Cloak
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/
# Compile gun-plugin
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/ COPY --from=upx /tmp/upx /usr/bin/
RUN ls /plugins/* | xargs -P0 -n1 upx -9 RUN ls /plugins/* | xargs -P0 -n1 upx -9
# Combine sip003 plugins # Combine sip003 plugins
FROM ${ALPINE_IMG} AS plugin FROM ${ALPINE} AS plugin
COPY --from=plugin-1 /plugins/ /plugins/ COPY --from=plugin-1 /plugins/ /plugins/
COPY --from=plugin-2 /plugins/ /plugins/ COPY --from=plugin-2 /plugins/ /plugins/
COPY --from=plugin-3 /plugins/ /plugins/ COPY --from=plugin-3 /plugins/ /plugins/
COPY --from=plugin-4 /plugins/ /plugins/
# Compile xray-core # Compile xray-core
FROM ${GO19_IMG} AS xray FROM ${GO19} AS xray
ENV XRAY="1.6.0" 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 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/ WORKDIR ./Xray-core-${XRAY}/main/
@ -270,7 +259,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/xray RUN upx -9 /tmp/xray
# Compile v2ray-core # Compile v2ray-core
FROM ${GO19_IMG} AS v2ray FROM ${GO19} AS v2ray
ENV V2FLY="5.1.0" 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 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/ WORKDIR ./v2ray-core-${V2FLY}/main/
@ -280,7 +269,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/v2ray RUN upx -9 /tmp/v2ray
# Compile trojan-go # Compile trojan-go
FROM ${GO17_IMG} AS trojan-go FROM ${GO18} AS trojan-go
ENV TROJAN_GO="v0.10.6" ENV TROJAN_GO="v0.10.6"
RUN apk add git && git clone https://github.com/p4gefau1t/trojan-go.git RUN apk add git && git clone https://github.com/p4gefau1t/trojan-go.git
WORKDIR ./trojan-go/ WORKDIR ./trojan-go/
@ -293,21 +282,20 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/trojan-go RUN upx -9 /tmp/trojan-go
# Compile trojan # Compile trojan
FROM ${ALPINE_IMG} AS trojan FROM ${ALPINE} AS trojan
ENV TROJAN="1.16.0" ENV TROJAN="1.16.0"
RUN apk add boost-dev cmake openssl-dev RUN apk add boost-dev cmake openssl-dev
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN wget https://github.com/trojan-gfw/trojan/archive/refs/tags/v${TROJAN}.tar.gz && \ RUN wget https://github.com/trojan-gfw/trojan/archive/refs/tags/v${TROJAN}.tar.gz && \
tar xf v${TROJAN}.tar.gz && /apk/setup tar xf v${TROJAN}.tar.gz && /apk/setup
WORKDIR ./trojan-${TROJAN}/build/ WORKDIR ./trojan-${TROJAN}/build/
RUN cmake .. -DENABLE_MYSQL=OFF -DSYSTEMD_SERVICE=OFF && make && strip trojan && mv trojan /tmp/ RUN cmake -DENABLE_MYSQL=OFF -DSYSTEMD_SERVICE=OFF .. && make && strip trojan && mv trojan /tmp/
COPY --from=trojan-go /tmp/trojan-go /tmp/ COPY --from=trojan-go /tmp/trojan-go /tmp/
# Compile gost and gost-v3 # Compile gost and gost-v3
FROM ${GO19_IMG} AS gost FROM ${GO19} AS gost
ENV GOST="2.11.4" ENV GOST="2.11.4"
ENV GOST_V3="3.0.0-beta.5" ENV GOST_V3="3.0.0-beta.5"
RUN apk add git
RUN wget https://github.com/ginuerzh/gost/archive/refs/tags/v${GOST}.tar.gz && tar xf v${GOST}.tar.gz && \ 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 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/ WORKDIR /go/gost-${GOST}/cmd/gost/
@ -320,21 +308,21 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN ls /tmp/gost* | xargs -P0 -n1 upx -9 RUN ls /tmp/gost* | xargs -P0 -n1 upx -9
# Compile brook # Compile brook
FROM ${GO16_IMG} AS brook FROM ${GO16} AS brook
ENV BROOK="20221010" ENV BROOK="20221010"
RUN wget https://github.com/txthinking/brook/archive/refs/tags/v${BROOK}.tar.gz && tar xf v${BROOK}.tar.gz 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/ WORKDIR ./brook-${BROOK}/cli/brook/
RUN go mod download -x RUN go get -d
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv brook /tmp/ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w" && mv brook /tmp/
COPY --from=upx /tmp/upx /usr/bin/ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/brook RUN upx -9 /tmp/brook
# Compile clash # Compile clash
FROM ${GO19_IMG} AS clash FROM ${GO19} AS clash
ENV CLASH="1.11.8" 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 RUN wget https://github.com/Dreamacro/clash/archive/refs/tags/v${CLASH}.tar.gz && tar xf v${CLASH}.tar.gz
WORKDIR ./clash-${CLASH}/ WORKDIR ./clash-${CLASH}/
RUN go mod download -x RUN go get -d
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w \ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w \
-X 'github.com/Dreamacro/clash/constant.Version=${CLASH}' \ -X 'github.com/Dreamacro/clash/constant.Version=${CLASH}' \
-X 'github.com/Dreamacro/clash/constant.BuildTime=$(date -u)'" && \ -X 'github.com/Dreamacro/clash/constant.BuildTime=$(date -u)'" && \
@ -343,7 +331,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/clash RUN upx -9 /tmp/clash
# Download naiveproxy # Download naiveproxy
FROM ${ALPINE_IMG} AS naive FROM ${ALPINE} AS naive
ENV NAIVE="v106.0.5249.91-1" ENV NAIVE="v106.0.5249.91-1"
COPY --from=build-base /apk/ /apk/ COPY --from=build-base /apk/ /apk/
RUN apk add curl libgcc jq && /apk/setup RUN apk add curl libgcc jq && /apk/setup
@ -357,11 +345,10 @@ RUN echo "while read FILE_NAME; do" >> naive.sh && \
echo "done < list.dat" >> naive.sh && sh naive.sh && strip /tmp/naive echo "done < list.dat" >> naive.sh && sh naive.sh && strip /tmp/naive
# Compile open-snell # Compile open-snell
FROM ${GO17_IMG} AS snell FROM ${GO18} AS snell
ENV SNELL="3.0.1" 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 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}/ WORKDIR ./open-snell-${SNELL}/
RUN go get -d
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags \ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags \
"-s -w -X 'github.com/icpz/open-snell/constants.Version=${SNELL}'" ./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 \ env CGO_ENABLED=0 go build -v -trimpath -ldflags \
@ -371,7 +358,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN ls /tmp/snell-* | xargs -P0 -n1 upx -9 RUN ls /tmp/snell-* | xargs -P0 -n1 upx -9
# Compile hysteria # Compile hysteria
FROM ${GO19_IMG} AS hysteria FROM ${GO19} AS hysteria
ENV HYSTERIA="v1.2.1" ENV HYSTERIA="v1.2.1"
RUN apk add git RUN apk add git
RUN git clone https://github.com/HyNetwork/hysteria.git RUN git clone https://github.com/HyNetwork/hysteria.git
@ -386,7 +373,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/hysteria RUN upx -9 /tmp/hysteria
# Compile relaybaton # Compile relaybaton
FROM ${GO14_IMG} AS relaybaton FROM ${GO14} AS relaybaton
ENV RELAYBATON="0.6.0" ENV RELAYBATON="0.6.0"
RUN apk add build-base git perl rsync RUN apk add build-base git perl rsync
RUN wget https://github.com/iyouport-org/relaybaton/archive/refs/tags/v${RELAYBATON}.tar.gz && tar xf v${RELAYBATON}.tar.gz RUN wget https://github.com/iyouport-org/relaybaton/archive/refs/tags/v${RELAYBATON}.tar.gz && tar xf v${RELAYBATON}.tar.gz
@ -397,16 +384,17 @@ COPY --from=upx /upx/ /usr/
RUN upx -9 /tmp/relaybaton RUN upx -9 /tmp/relaybaton
# Compile dnsproxy # Compile dnsproxy
FROM ${GO18_IMG} AS dnsproxy FROM ${GO18} AS dnsproxy
ENV DNSPROXY="0.45.2" 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 RUN wget https://github.com/AdguardTeam/dnsproxy/archive/refs/tags/v${DNSPROXY}.tar.gz && tar xf v${DNSPROXY}.tar.gz
WORKDIR ./dnsproxy-${DNSPROXY}/ WORKDIR ./dnsproxy-${DNSPROXY}/
RUN go get -d
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DNSPROXY} -s -w" && mv dnsproxy /tmp/ 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/ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/dnsproxy RUN upx -9 /tmp/dnsproxy
# Compile mad # Compile mad
FROM ${GO16_IMG} AS mad FROM ${GO16} AS mad
ENV MAD="20210401" ENV MAD="20210401"
RUN wget https://github.com/txthinking/mad/archive/refs/tags/v${MAD}.tar.gz && tar xf v${MAD}.tar.gz 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/ WORKDIR ./mad-${MAD}/cli/mad/
@ -416,7 +404,7 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/mad RUN upx -9 /tmp/mad
# Combine all release # Combine all release
FROM ${PYTHON_IMG} AS build FROM ${PYTHON} AS build
COPY --from=python-pkg /packages.tar.gz / COPY --from=python-pkg /packages.tar.gz /
ARG PYTHON="3.10" ARG PYTHON="3.10"
WORKDIR /release/usr/local/lib/python${PYTHON}/site-packages/ WORKDIR /release/usr/local/lib/python${PYTHON}/site-packages/
@ -436,10 +424,10 @@ COPY --from=hysteria /tmp/hysteria /release/usr/bin/
COPY --from=relaybaton /tmp/relaybaton /release/usr/bin/ COPY --from=relaybaton /tmp/relaybaton /release/usr/bin/
COPY --from=dnsproxy /tmp/dnsproxy /release/usr/bin/ COPY --from=dnsproxy /tmp/dnsproxy /release/usr/bin/
COPY --from=mad /tmp/mad /release/usr/bin/ COPY --from=mad /tmp/mad /release/usr/bin/
COPY . /release/usr/local/share/ProxyC/ COPY ./ /release/usr/local/share/ProxyC/
# Release docker image # Release proxyc image
FROM ${PYTHON_IMG} FROM ${PYTHON}
RUN apk add --no-cache boost-program_options c-ares ca-certificates libev libsodium libstdc++ mbedtls pcre && \ 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 ln -s /usr/local/share/ProxyC/Main.py /usr/bin/proxyc
COPY --from=build /release/ / COPY --from=build /release/ /

Loading…
Cancel
Save