mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
Update
- Builder based environment move to Alpine - Final image update to 3.16
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,16 +1,16 @@
|
||||
FROM --platform=$BUILDPLATFORM rust:1.53.0-buster AS builder
|
||||
FROM --platform=$BUILDPLATFORM rust:1.61.0-alpine AS builder
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essential curl musl-tools
|
||||
RUN set -x \
|
||||
&& apk add --no-cache build-base
|
||||
|
||||
WORKDIR /root/shadowsocks-rust
|
||||
|
||||
ADD . .
|
||||
|
||||
RUN rustup install nightly && rustup default nightly && \
|
||||
case "$TARGETARCH" in \
|
||||
"386") \
|
||||
RUN case "$TARGETARCH" in \
|
||||
"386") \
|
||||
RUST_TARGET="i686-unknown-linux-musl" \
|
||||
MUSL="i686-linux-musl" \
|
||||
;; \
|
||||
@@ -26,14 +26,16 @@ RUN rustup install nightly && rustup default nightly && \
|
||||
echo "Doesn't support $TARGETARCH architecture" \
|
||||
exit 1 \
|
||||
;; \
|
||||
esac && \
|
||||
wget -qO- "https://musl.cc/$MUSL-cross.tgz" | tar -xzC /root/ && \
|
||||
CC=/root/$MUSL-cross/bin/$MUSL-gcc && \
|
||||
rustup target add $RUST_TARGET && \
|
||||
RUSTFLAGS="-C linker=$CC" CC=$CC cargo build --target "$RUST_TARGET" --release --features "local-tun local-redir armv8 neon" && \
|
||||
mv target/$RUST_TARGET/release/ss* target/release/
|
||||
esac \
|
||||
&& wget -qO- "https://musl.cc/$MUSL-cross.tgz" | tar -xzC /root/ \
|
||||
&& CC=/root/$MUSL-cross/bin/$MUSL-gcc \
|
||||
&& rustup target add $RUST_TARGET \
|
||||
&& RUSTFLAGS="-C linker=$CC" \
|
||||
&& CC=$CC \
|
||||
&& cargo build --target "$RUST_TARGET" --release --features "local-tun local-redir armv8 neon stream-cipher aead-cipher-2022" \
|
||||
&& mv target/$RUST_TARGET/release/ss* target/release/
|
||||
|
||||
FROM alpine:3.14 AS sslocal
|
||||
FROM alpine:3.16 AS sslocal
|
||||
|
||||
COPY --from=builder /root/shadowsocks-rust/target/release/sslocal /usr/local/bin/
|
||||
COPY --from=builder /root/shadowsocks-rust/examples/config.json /etc/shadowsocks-rust/
|
||||
@@ -42,11 +44,12 @@ COPY --from=builder /root/shadowsocks-rust/docker/docker-entrypoint.sh /usr/loca
|
||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||
CMD [ "sslocal", "--log-without-time", "-c", "/etc/shadowsocks-rust/config.json" ]
|
||||
|
||||
FROM alpine:3.14 AS ssserver
|
||||
FROM alpine:3.16 AS ssserver
|
||||
|
||||
COPY --from=builder /root/shadowsocks-rust/target/release/ssserver /usr/local/bin/
|
||||
COPY --from=builder /root/shadowsocks-rust/examples/config.json /etc/shadowsocks-rust/
|
||||
COPY --from=builder /root/shadowsocks-rust/docker/docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||
|
||||
CMD [ "ssserver", "--log-without-time", "-a", "nobody", "-c", "/etc/shadowsocks-rust/config.json" ]
|
||||
Reference in New Issue
Block a user