Browse Source

refactor: more detailed docker multi-stage builds

master
dnomd343 2 years ago
parent
commit
90da6df649
  1. 348
      Dockerfile

348
Dockerfile

@ -1,114 +1,132 @@
FROM alpine:3.16.0 AS ss-libev # Compile shadowsocks-rust
ENV SS_LIBEV="3.3.5" FROM rust:1.62-alpine3.16 AS ss-rust
ENV SS_RUST="v1.15.0-alpha.8"
RUN \ RUN \
# Source code downloads and dependent installations apk add build-base && \
apk add asciidoc build-base c-ares-dev libev-dev libsodium-dev linux-headers mbedtls-dev pcre-dev xmlto && \ wget https://github.com/shadowsocks/shadowsocks-rust/archive/refs/tags/${SS_RUST}.tar.gz && \
wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$SS_LIBEV/shadowsocks-libev-$SS_LIBEV.tar.gz && \ tar xf ${SS_RUST}.tar.gz && cd ./shadowsocks-rust-*/ && \
wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz && \ cargo build --release --features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra" && \
ls ./*.tar.gz | xargs -n1 tar xf && \ cd ./target/release/ && mv ./sslocal /tmp/ss-rust-local && mv ./ssserver /tmp/ss-rust-server
mkdir -p /tmp/release/ && \
\
# Compile shadowsocks-libev
cd ./shadowsocks-libev-$SS_LIBEV/ && \
./configure --prefix=/usr && make && make install && \
mv /usr/bin/ss-local /tmp/release/ss-libev-local && \
mv /usr/bin/ss-server /tmp/release/ss-libev-server && \
\
# Compile and install openssl (version 1.0.2u)
cd ../openssl-1.0.2u/ && \
./config --shared --prefix=/usr && make && make install && \
cp /usr/lib/libcrypto.so.1.0.0 /tmp/release/
FROM rust:1.62.0-alpine3.16 AS ss-rust # Compile shadowsocks-libev
ENV SS_RUST="v1.15.0-alpha.5" FROM alpine:3.16 AS ss-libev
ENV SS_LIBEV="3.3.5"
RUN \ RUN \
apk add git build-base && \ apk add build-base c-ares-dev libev-dev libsodium-dev linux-headers mbedtls-dev pcre-dev && \
mkdir -p /tmp/release/ && \ wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SS_LIBEV}/shadowsocks-libev-${SS_LIBEV}.tar.gz && \
git clone https://github.com/shadowsocks/shadowsocks-rust.git && \ tar xf shadowsocks-libev-*.tar.gz && cd ./shadowsocks-libev-*/ && \
cd ./shadowsocks-rust/ && git checkout $SS_RUST && \ ./configure --disable-documentation --prefix=/usr && make && make install && \
cargo build --release --features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra" && \ cd /usr/bin && mv ./ss-local /tmp/ss-libev-local && mv ./ss-server /tmp/ss-libev-server
mv ./target/release/sslocal /tmp/release/ss-rust-local && \
mv ./target/release/ssserver /tmp/release/ss-rust-server
FROM python:3.10.5-alpine3.16 AS ss-python # Package shadowsocks-python (lastest version, legacy version, R version aka ssr)
FROM python:3.10-alpine3.16 AS ss-python
ENV SS_PYTHON_LEGACY="2.6.2" ENV SS_PYTHON_LEGACY="2.6.2"
RUN \ RUN \
apk add build-base cmake git glib-dev && \ apk add git && mkdir /packages/ && \
git clone https://github.com/dnomd343/shadowsocksr.git && \ git clone https://github.com/dnomd343/shadowsocksr.git && \
git clone https://github.com/shadowsocks/shadowsocks.git && \ git clone https://github.com/shadowsocks/shadowsocks.git && \
git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && \ wget https://github.com/shadowsocks/shadowsocks/archive/refs/tags/${SS_PYTHON_LEGACY}.tar.gz && \
wget https://github.com/shadowsocks/shadowsocks/archive/refs/tags/$SS_PYTHON_LEGACY.tar.gz && \ tar xf ${SS_PYTHON_LEGACY}.tar.gz
mkdir -p /tmp/release/ && \ # shadowsocks-python (R version)
tar xf ./*.tar.gz && \ RUN \
\
# Package shadowsocksr
cd ./shadowsocksr/ && \ cd ./shadowsocksr/ && \
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ 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 "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 && cd ./build/ && mv ./lib/ ./ssr-python/ && \ python3 setup.py build && cd ./build/lib/shadowsocks/ && \
mv ./ssr-python/shadowsocks/local.py ./ssr-python/shadowsocks/server.py ./ssr-python/ && \ chmod +x ./local.py ./server.py && mv ./local.py ./server.py ../ && \
chmod +x ./ssr-python/local.py ./ssr-python/server.py && \ mv ../../lib/ /packages/ssr-python/
BZIP2=-9 tar cjf /tmp/release/ssr-python.tar.bz2 ./ssr-python/ && \ # shadowsocks-python (latest version)
\ RUN \
# Package shadowsocks-python (latest version) cd ./shadowsocks/ && git checkout master && \
cd ../../shadowsocks/ && git checkout master && \
sed -i 's/if addr is/if addr ==/g' ./shadowsocks/common.py && \ 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/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/if len(block) is/if len(block) ==/g' ./shadowsocks/common.py && \
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \
python3 setup.py build && cd ./build/ && mv ./lib/ ./ss-python/ && \ python3 setup.py build && cd ./build/lib/shadowsocks/ && \
mv ./ss-python/shadowsocks/local.py ./ss-python/shadowsocks/server.py ./ss-python/ && \ chmod +x ./local.py ./server.py && mv ./local.py ./server.py ../ && \
chmod +x ./ss-python/local.py ./ss-python/server.py && \ mv ../../lib/ /packages/ss-python/
BZIP2=-9 tar cjf /tmp/release/ss-python.tar.bz2 ./ss-python/ && \ # shadowsocks-python (legacy version)
\ RUN \
# Package shadowsocks-python (legacy version) cd ./shadowsocks-${SS_PYTHON_LEGACY}/ && \
cd ../../shadowsocks-$SS_PYTHON_LEGACY/ && \
sed -i 's/MutableMapping/abc.MutableMapping/' ./shadowsocks/lru_cache.py && \ 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)/'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 && \ sed -i "s/find_library(p)/'libcrypto.so.1.0.0'/g" ./shadowsocks/crypto/ctypes_openssl.py && \
python3 setup.py build && cd ./build/ && mv ./lib/ ./ss-python-legacy/ && \ python3 setup.py build && cd ./build/lib/shadowsocks/ && \
mv ./ss-python-legacy/shadowsocks/local.py ./ss-python-legacy/shadowsocks/server.py ./ss-python-legacy/ && \ chmod +x ./local.py ./server.py && mv ./local.py ./server.py ../ && \
chmod +x ./ss-python-legacy/local.py ./ss-python-legacy/server.py && \ mv ../../lib/ /packages/ss-python-legacy/
BZIP2=-9 tar cjf /tmp/release/ss-python-legacy.tar.bz2 ./ss-python-legacy/ && \
\
# Compile shadowsocks-bootstrap # Compile shadowsocks-bootstrap
cd ../../shadowsocks-bootstrap/ && mkdir ./build/ && \ FROM alpine:3.16 AS ss-bootstrap
cd ./build/ && cmake -DCMAKE_BUILD_TYPE=Release .. && make && \ RUN \
mv ../bin/* /tmp/release/ && \ apk add build-base cmake git glib-dev && \
\ git clone https://github.com/dnomd343/shadowsocks-bootstrap.git && \
cd ./shadowsocks-bootstrap/ && mkdir ./build/ && cd ./build/ && \
cmake -DCMAKE_BUILD_TYPE=Release .. && make && \
mv ../bin/ss-bootstrap-* /tmp/
# Compile openssl (old version, for shadowsocks method -> idea-cfb / seed-cfb)
FROM alpine:3.16 AS openssl
ENV OPENSSL_VER="1.0.2"
ENV OPENSSL_SUB_VER="u"
RUN \
apk add build-base perl && \
wget https://www.openssl.org/source/old/${OPENSSL_VER}/openssl-${OPENSSL_VER}${OPENSSL_SUB_VER}.tar.gz && \
tar xf openssl-*.tar.gz && cd ./openssl-*/ && \
./config --shared --prefix=/usr && make && \
mv ./libcrypto.so.1.0.0 /tmp/
# Build numpy and salsa20 python module # Build numpy and salsa20 python module
mkdir /tmp/salsa20/ && \ FROM python:3.10-alpine3.16 AS salsa20
RUN \
apk add build-base && \
pip3 install numpy salsa20 && \ pip3 install numpy salsa20 && \
cd /usr/local/lib/python*/site-packages/ && \ cd /usr/local/lib/python*/site-packages/ && \
mv ./*numpy* ./*salsa20* /tmp/salsa20/ && \ mkdir /packages/ && mv ./*numpy* ./*salsa20* /packages/ && \
cd /tmp/salsa20/ && rm -rf `find ./ -name '__pycache__'` && \ rm -rf $(find /packages/ -name '__pycache__')
BZIP2=-9 tar cjf /tmp/release/salsa20.tar.bz2 ./*
FROM rust:1.62.0-alpine3.16 AS plugin-1 # Combine shadowsocks dependencies
FROM python:3.10-alpine3.16 AS shadowsocks
COPY --from=ss-rust /tmp/ss-rust-* /release/
COPY --from=ss-libev /tmp/ss-libev-* /release/
COPY --from=ss-python /packages/ /site-packages/
COPY --from=ss-bootstrap /tmp/ss-bootstrap-* /release/
COPY --from=openssl /tmp/libcrypto.so* /release/
COPY --from=salsa20 /packages/ /site-packages/
RUN \ RUN \
apk add asciidoc autoconf automake build-base git libev-dev libtool linux-headers xmlto && \ PYTHON_PACKAGE="/usr/local/lib/$(ls /usr/local/lib/ | grep ^python)/site-packages" && \
git clone https://github.com/shadowsocks/qtun.git && \ ln -s ${PYTHON_PACKAGE}/ssr-python/local.py /release/ssr-local && \
ln -s ${PYTHON_PACKAGE}/ssr-python/server.py /release/ssr-server && \
ln -s ${PYTHON_PACKAGE}/ss-python/local.py /release/ss-python-local && \
ln -s ${PYTHON_PACKAGE}/ss-python/server.py /release/ss-python-server && \
ln -s ${PYTHON_PACKAGE}/ss-python-legacy/local.py /release/ss-python-legacy-local && \
ln -s ${PYTHON_PACKAGE}/ss-python-legacy/server.py /release/ss-python-legacy-server && \
BZIP2=-9 tar cjf /release/packages.tar.bz2 ./site-packages/
# Compile sip003 plugins (part1 -> gcc & cargo)
FROM rust:1.62-alpine3.16 AS plugin-1
RUN \
apk add git && mkdir /plugins/ && \
git clone https://github.com/shadowsocks/simple-obfs.git && \ git clone https://github.com/shadowsocks/simple-obfs.git && \
mkdir /tmp/release/ && \ git clone https://github.com/shadowsocks/qtun.git
# Compile simple-obfs # Compile simple-obfs
cd ./simple-obfs/ && \ RUN \
git submodule update --init --recursive && \ apk add autoconf automake build-base libev-dev libtool linux-headers && \
./autogen.sh && ./configure && make && make install && \ cd ./simple-obfs/ && git submodule update --init --recursive && \
mv /usr/local/bin/obfs-local /usr/local/bin/obfs-server /tmp/release/ && \ ./autogen.sh && ./configure --disable-documentation && make && \
\ cd ./src/ && mv ./obfs-local ./obfs-server /plugins/
# Compile qtun # Compile qtun
cd ../qtun/ && \ RUN \
cargo build --release && \ cd ./qtun/ && cargo build --release && \
mv ./target/release/qtun-client /tmp/release/ && \ cd ./target/release/ && mv ./qtun-client ./qtun-server /plugins/
mv ./target/release/qtun-server /tmp/release/
FROM golang:1.16.15-alpine3.15 AS plugin-2 # Compile sip003 plugins (part2 -> go1.16)
FROM golang:1.16-alpine3.15 AS plugin-2
ENV GOST_PLUGIN="v1.6.3" ENV GOST_PLUGIN="v1.6.3"
RUN \ RUN \
apk add git && mkdir /tmp/release/ && \ apk add git && mkdir /plugins/ && \
git clone https://github.com/Qv2ray/gun.git && \ git clone https://github.com/Qv2ray/gun.git && \
git clone https://github.com/dnomd343/kcptun.git && \ git clone https://github.com/dnomd343/kcptun.git && \
git clone https://github.com/dnomd343/GoQuiet.git && \ git clone https://github.com/dnomd343/GoQuiet.git && \
@ -116,138 +134,102 @@ RUN \
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 && \
git clone https://github.com/shadowsocks/v2ray-plugin.git && \ git clone https://github.com/shadowsocks/v2ray-plugin.git && \
git clone https://github.com/IrineSistiana/mos-tls-tunnel.git && \ git clone https://github.com/IrineSistiana/mos-tls-tunnel.git
\
# Compile v2ray-plugin # Compile v2ray-plugin
cd ./v2ray-plugin/ && VERSION=`git describe --tags` && \ RUN \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$VERSION -s -w" && \ cd ./v2ray-plugin/ && \
mv ./v2ray-plugin /tmp/release/ && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && \
\ mv ./v2ray-plugin /plugins/
# Compile kcptun # Compile kcptun
cd ../kcptun/ && git checkout sip003 && VERSION=`git describe --tags` && \ RUN \
cd ./kcptun/ && git checkout sip003 && \
go mod init github.com/shadowsocks/kcptun && go mod tidy && \ go mod init github.com/shadowsocks/kcptun && go mod tidy && \
env CGO_ENABLED=0 go build -o kcptun-client -trimpath -ldflags "-X main.VERSION=$VERSION -s -w" ./client && \ env CGO_ENABLED=0 go build -o kcptun-client -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./client && \
env CGO_ENABLED=0 go build -o kcptun-server -trimpath -ldflags "-X main.VERSION=$VERSION -s -w" ./server && \ env CGO_ENABLED=0 go build -o kcptun-server -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" ./server && \
mv ./kcptun-client ./kcptun-server /tmp/release/ && \ mv ./kcptun-client ./kcptun-server /plugins/
\
# Compile gost-plugin # Compile gost-plugin
cd ../gost-plugin/ && \ RUN \
git checkout $GOST_PLUGIN -b build && VERSION=`git describe --tags` && \ cd ./gost-plugin/ && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$VERSION -s -w" && \ git checkout ${GOST_PLUGIN} -b build && \
mv ./gost-plugin /tmp/release && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && \
\ mv ./gost-plugin /plugins/
# Compile GoQuiet # Compile GoQuiet
cd ../GoQuiet/ && VERSION=`git describe --tags` && \ RUN \
cd ./GoQuiet/ && \
go mod init github.com/cbeuw/GoQuiet && \ go mod init github.com/cbeuw/GoQuiet && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$VERSION -s -w" ./cmd/gq-client && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-client && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$VERSION -s -w" ./cmd/gq-server && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/gq-server && \
mv ./gq-client ./gq-server /tmp/release/ && \ mv ./gq-client ./gq-server /plugins/
\ # Compile mos-tls-tunnel
# mos-tls-tunnel RUN \
cd ../mos-tls-tunnel/ && \ cd ./mos-tls-tunnel/ && \
go mod init github.com/IrineSistiana/mos-tls-tunnel && go mod vendor && \ go mod init github.com/IrineSistiana/mos-tls-tunnel && go mod vendor && \
env CGO_ENABLED=0 go build -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-client && \ env CGO_ENABLED=0 go build -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-client && \
env CGO_ENABLED=0 go build -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-server && \ env CGO_ENABLED=0 go build -mod=vendor -trimpath -ldflags "-s -w" ./cmd/mtt-server && \
mv ./mtt-client ./mtt-server /tmp/release/ && \ mv ./mtt-client ./mtt-server /plugins/
\
# Compile rabbit-plugin # Compile rabbit-plugin
cd ../rabbit-plugin/ && \ RUN \
cd ./rabbit-plugin/ && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" && \
mv ./rabbit-plugin /tmp/release/ && \ mv ./rabbit-plugin /plugins/
\
# Compile rabbit-tcp # Compile rabbit-tcp
cd ../rabbit-tcp/ && VERSION=`git describe --tags` && \ RUN \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.Version=$VERSION -s -w" ./cmd/rabbit.go && \ cd ./rabbit-tcp/ && \
mv ./rabbit /tmp/release/ && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.Version=$(git describe --tags) -s -w" ./cmd/rabbit.go && \
\ mv ./rabbit /plugins/
# Compile gun-plugin # Compile gun-plugin
cd ../gun/ && \ RUN \
cd ./gun/ && \
env CGO_ENABLED=0 go build -o gun-plugin -trimpath -ldflags "-s -w" ./cmd/sip003/ && \ env CGO_ENABLED=0 go build -o gun-plugin -trimpath -ldflags "-s -w" ./cmd/sip003/ && \
mv ./gun-plugin /tmp/release/ mv ./gun-plugin /plugins/
FROM golang:1.17.11-alpine3.16 AS plugin-3 # Compile sip003 plugins (part3 -> go1.17)
FROM golang:1.17-alpine3.16 AS plugin-3
ENV SIMPLE_TLS="v0.7.0" ENV SIMPLE_TLS="v0.7.0"
RUN \ RUN \
apk add git && mkdir /tmp/release/ && \ apk add git && mkdir /plugins/ && \
git clone https://github.com/cbeuw/Cloak.git && \ git clone https://github.com/cbeuw/Cloak.git && \
git clone https://github.com/teddysun/xray-plugin.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
RUN \
cd ./simple-tls/ && \ cd ./simple-tls/ && \
git checkout $SIMPLE_TLS -b build && VERSION=`git describe --tags` && \ git checkout ${SIMPLE_TLS} -b build && \
sed -i 's/version = "unknown\/dev"/version = "'$VERSION'"/g' main.go && \ sed -i 's/version = "unknown\/dev"/version = "'$(git describe --tags)'"/g' main.go && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" && \
mv ./simple-tls /tmp/release/ && \ mv ./simple-tls /plugins/
\
# Compile xray-plugin # Compile xray-plugin
cd ../xray-plugin/ && VERSION=`git describe --tags` && \ RUN \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$VERSION -s -w" && \ cd ./xray-plugin/ && \
mv ./xray-plugin /tmp/release/ && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VERSION=$(git describe --tags) -s -w" && \
\ mv ./xray-plugin /plugins/
# Compile Cloak # Compile Cloak
cd ../Cloak/ && VERSION=`git describe --tags` && \ RUN \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$VERSION -s -w" ./cmd/ck-client && \ cd ./Cloak/ && \
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$VERSION -s -w" ./cmd/ck-server && \ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-client && \
mv ./ck-client ./ck-server /tmp/release/ env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$(git describe --tags) -s -w" ./cmd/ck-server && \
mv ./ck-client ./ck-server /plugins/
FROM python:3.10.5-alpine3.16 AS asset # Combine sip003 plugins
COPY --from=ss-rust /tmp/release /tmp/release FROM busybox AS plugin
COPY --from=ss-libev /tmp/release /tmp/release COPY --from=plugin-1 /plugins/ /release/
COPY --from=ss-python /tmp/release /tmp/release COPY --from=plugin-2 /plugins/ /release/
COPY --from=plugin-1 /tmp/release /tmp/release COPY --from=plugin-3 /plugins/ /release/
COPY --from=plugin-2 /tmp/release /tmp/release
COPY --from=plugin-3 /tmp/release /tmp/release
RUN \
PACKAGE_DIR="usr/local/lib/$(ls /usr/local/lib/ | grep ^python)/site-packages" && \
mkdir -p /asset/$PACKAGE_DIR/ && \
cd /asset/$PACKAGE_DIR/ && mv /tmp/release/*.tar.bz2 ./ && \
ls ./*.tar.bz2 | xargs -n1 tar xf && rm -rf ./*.tar.bz2 && \
mkdir -p /asset/usr/bin/ && mkdir -p /asset/lib/ && \
ln -s /$PACKAGE_DIR/ssr-python/local.py /asset/usr/bin/ssr-local && \
ln -s /$PACKAGE_DIR/ssr-python/server.py /asset/usr/bin/ssr-server && \
ln -s /$PACKAGE_DIR/ss-python/local.py /asset/usr/bin/ss-python-local && \
ln -s /$PACKAGE_DIR/ss-python/server.py /asset/usr/bin/ss-python-server && \
ln -s /$PACKAGE_DIR/ss-python-legacy/local.py /asset/usr/bin/ss-python-legacy-local && \
ln -s /$PACKAGE_DIR/ss-python-legacy/server.py /asset/usr/bin/ss-python-legacy-server && \
mv /tmp/release/*.so* /asset/lib/ && \
mv /tmp/release/* /asset/usr/bin/
FROM python:3.10.5-alpine3.16 # Combine all release
FROM python:3.10-alpine3.16 AS asset
COPY --from=shadowsocks /release/ /release/
COPY --from=plugin /release/ /release/
RUN \
PACKAGE_DIR="/asset/usr/local/lib/$(ls /usr/local/lib/ | grep ^python)" && \
mkdir -p ${PACKAGE_DIR}/ && tar xf /release/packages.tar.bz2 -C ${PACKAGE_DIR}/ && \
mkdir -p /asset/lib/ && mv /release/*.so* /asset/lib/ && \
rm -f /release/packages.tar.bz2 && \
mv /release/ /asset/usr/bin/
# Release docker image
FROM python:3.10-alpine3.16
COPY --from=asset /asset / COPY --from=asset /asset /
RUN \ RUN \
apk add --no-cache c-ares glib libev libsodium mbedtls pcre && \ apk add --no-cache c-ares glib libev libsodium mbedtls pcre && \
pip3 --no-cache-dir install colorlog pysocks requests pip3 --no-cache-dir install colorlog pysocks requests
# ss-libev-server --help
# ss-libev-local --help
# ss-rust-server --help
# ss-rust-local --help
# ss-bootstrap-server --help
# ss-bootstrap-local --help
# ss-python-server --help
# ss-python-local --help
# ss-python-legacy-server --help
# ss-python-legacy-local --help
# ssr-server --help
# ssr-local --help
# obfs-local --help
# obfs-server --help
# simple-tls --help
# v2ray-plugin --help
# xray-plugin --help
# kcptun-client --help
# kcptun-server --help
# gost-plugin --help
# ck-client --help
# ck-server --help
# gq-client --help
# gq-server --help
# mtt-client --help
# mtt-server --help
# rabbit-plugin --help
# rabbit --help
# qtun-client --help
# qtun-server --help
# gun-plugin --help

Loading…
Cancel
Save