From 45173ba16eb85fd08f4bd9e9a5bacd899b0aaa62 Mon Sep 17 00:00:00 2001 From: Pain Date: Tue, 7 Apr 2026 11:44:23 +0800 Subject: [PATCH 1/3] Bump AlpineLinux to v3.19 - fix strip error --- docker/alpine/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 799497463..43ab0dfba 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.16 +FROM alpine:3.19 LABEL maintainer="kev , Sah , vndroid " ENV SERVER_ADDR=0.0.0.0 @@ -31,7 +31,7 @@ RUN set -x \ && make install \ && cd /usr/local/bin \ && ls /usr/local/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \ - && strip $(ls /usr/local/bin | grep -Ev 'ss-nat') \ + && strip $(ls /usr/local/bin | grep -Ev 'ss-nat' | grep -Ev 'ss-setup') \ && apk del .build-deps \ # Runtime dependencies setup && apk add --no-cache \ From 6410fba9a77375a7369aae8b2c6c2de44a928077 Mon Sep 17 00:00:00 2001 From: biliwala <72666349+biliwala@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:00:15 +0800 Subject: [PATCH 2/3] fix: stop strip from choking on non-binary files in Docker build The build logic has been updated to use `scanelf` to identify and target only ELF binaries for stripping, avoiding build failures caused by the `strip` command targeting non-binary scripts like `ss-nat` and `ss-setup`. --- docker/alpine/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 43ab0dfba..b3e5b0179 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -31,7 +31,7 @@ RUN set -x \ && make install \ && cd /usr/local/bin \ && ls /usr/local/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \ - && strip $(ls /usr/local/bin | grep -Ev 'ss-nat' | grep -Ev 'ss-setup') \ + && strip $(scanelf --nobanner -E ET_DYN -E ET_EXEC /usr/local/bin/ss-* | awk '{print $2}') \ && apk del .build-deps \ # Runtime dependencies setup && apk add --no-cache \ From 71b07a24e3f70cdd3602eb8938c44b9eb776b09d Mon Sep 17 00:00:00 2001 From: biliwala <72666349+biliwala@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:21:33 +0800 Subject: [PATCH 3/3] Bump Alpine version to 3.23 and reduce Docker image size via multi-stage build - Bump base image from Alpine 3.19 to 3.23 - Implement multi-stage build to reduce image size --- docker/alpine/Dockerfile | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index b3e5b0179..777c06bf7 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -1,14 +1,7 @@ -FROM alpine:3.19 -LABEL maintainer="kev , Sah , vndroid " +FROM alpine:3.23 AS builder -ENV SERVER_ADDR=0.0.0.0 -ENV SERVER_PORT=8388 -ENV PASSWORD= -ENV METHOD=aes-256-gcm -ENV TIMEOUT=300 -ENV DNS_ADDRS="8.8.8.8,8.8.4.4" -ENV TZ=UTC -ENV ARGS= +# Temporary root directory for build output +ENV DEST_DIR=/tmp/dest COPY . /tmp/repo RUN set -x \ @@ -28,11 +21,29 @@ RUN set -x \ && mkdir -p build && cd build \ && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTING=OFF -DWITH_STATIC=OFF -DCMAKE_BUILD_TYPE=Release \ && make -j$(getconf _NPROCESSORS_ONLN) \ - && make install \ - && cd /usr/local/bin \ - && ls /usr/local/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \ - && strip $(scanelf --nobanner -E ET_DYN -E ET_EXEC /usr/local/bin/ss-* | awk '{print $2}') \ - && apk del .build-deps \ + && mkdir -p ${DEST_DIR} \ + && make install DESTDIR=${DEST_DIR} \ + && cd ${DEST_DIR}/usr/local/bin \ + && ls ${DEST_DIR}/usr/local/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \ + && strip $(scanelf --nobanner -E ET_DYN -E ET_EXEC ${DEST_DIR}/usr/local/bin/ss-* | awk '{print $2}') + +# Final runtime environment +FROM alpine:3.23 +LABEL maintainer="kev , Sah , vndroid " + +ENV SERVER_ADDR=0.0.0.0 +ENV SERVER_PORT=8388 +ENV PASSWORD= +ENV METHOD=aes-256-gcm +ENV TIMEOUT=300 +ENV DNS_ADDRS="8.8.8.8,8.8.4.4" +ENV TZ=UTC +ENV ARGS= + +# Import build artifacts from the builder stage +COPY --from=builder /tmp/dest/ / + +RUN set -x \ # Runtime dependencies setup && apk add --no-cache \ ca-certificates \ @@ -40,8 +51,7 @@ RUN set -x \ tzdata \ $(scanelf --needed --nobanner /usr/local/bin/ss-* \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u) \ - && rm -rf /tmp/repo + | sort -u) COPY ./docker/alpine/entrypoint.sh /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["docker-entrypoint.sh"]