added V2 Ray plugin to shadowsocks docker image
All checks were successful
CI / Build shadowsocks-rust docker images (push) Successful in 1m3s

This commit is contained in:
2024-08-02 20:19:27 +08:00
parent 6bf1ecafd0
commit 53f0aae2e4
2 changed files with 37 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ FROM --platform=$BUILDPLATFORM rust:alpine AS builder
ARG VERSION TARGETPLATFORM BUILDPLATFORM
RUN set -x \
&& apk add --no-cache build-base cmake llvm15-dev clang15-libclang clang15 rust-bindgen git rustup
&& apk add --no-cache build-base cmake llvm15-dev clang15-libclang clang15 rust-bindgen git rustup curl
WORKDIR /root/shadowsocks-rust
@@ -40,12 +40,16 @@ RUN case "$TARGETPLATFORM" in \
&& RUSTFLAGS="-C linker=$CC" CC=$CC cargo build --target "$RUST_TARGET" --release --features "full-extra" \
&& mv target/$RUST_TARGET/release/ss* target/release/
FROM --platform=$TARGETPLATFORM alpine:3.20 AS sslocal
COPY download_v2ray.sh download_v2ray.sh
RUN ./download_v2ray.sh "$TARGETPLATFORM"
FROM alpine:3.20 AS sslocal
# NOTE: Please be careful to change the path of these binaries, refer to #1149 for more information.
COPY --from=builder /root/shadowsocks-rust/target/release/sslocal /usr/bin/
COPY --from=builder /root/shadowsocks-rust/examples/config.json /etc/shadowsocks-rust/
COPY --from=builder /root/shadowsocks-rust/docker/docker-entrypoint.sh /usr/bin/
COPY --from=builder /tmp/v2ray-plugin /usr/bin/v2ray-plugin
ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD [ "sslocal", "--log-without-time", "-c", "/etc/shadowsocks-rust/config.json" ]
@@ -55,6 +59,7 @@ FROM alpine:3.17 AS ssserver
COPY --from=builder /root/shadowsocks-rust/target/release/ssserver /usr/bin/
COPY --from=builder /root/shadowsocks-rust/examples/config.json /etc/shadowsocks-rust/
COPY --from=builder /root/shadowsocks-rust/docker/docker-entrypoint.sh /usr/bin/
COPY --from=builder /tmp/v2ray-plugin /usr/bin/v2ray-plugin
ENTRYPOINT [ "docker-entrypoint.sh" ]

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env sh
TARGETPLATFORM=$1
mkdir /tmp/v2ray_plugin.d
cd /tmp/v2ray_plugin.d
case "$TARGETPLATFORM" in
"linux/386")
url="curl -OJ https://gitea.woggioni.net/api/packages/woggioni/generic/v2ray_plugin-linux-386/v1.3.2-6-g5ffaa81/v2ray-plugin-linux-386-v1.3.2-6-g5ffaa81.tar.gz"
curl --retry 3 "$url" | tar -xvz
mv v2ray-plugin* /tmp/v2ray-plugin
;;
"linux/amd64")
url="https://gitea.woggioni.net/api/packages/woggioni/generic/v2ray_plugin-linux-amd64/v1.3.2-6-g5ffaa81/v2ray-plugin-linux-amd64-v1.3.2-6-g5ffaa81.tar.gz"
curl --retry 3 "$url" | tar -xvz
mv v2ray-plugin* /tmp/v2ray-plugin
;;
"linux/arm64")
url="https://gitea.woggioni.net/api/packages/woggioni/generic/v2ray_plugin-linux-arm64/v1.3.2-6-g5ffaa81/v2ray-plugin-linux-arm64-v1.3.2-6-g5ffaa81.tar.gz"
curl --retry 3 "$url" | tar -xvz
mv v2ray-plugin_linux_arm64 /tmp/v2ray-plugin
;;
"linux/arm/v7")
url="https://gitea.woggioni.net/api/packages/woggioni/generic/v2ray_plugin-linux-arm/v1.3.2-6-g5ffaa81/v2ray-plugin-linux-arm-v1.3.2-6-g5ffaa81.tar.gz"
curl --retry 3 "$url" | tar -xvz
mv v2ray-plugin_linux_armv7 /tmp/v2ray-plugin
;;
*)
echo "Doesn't support $TARGETPLATFORM architecture"
exit 1
;;
esac