diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 4f68846b..b35dbf9e 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -5,21 +5,8 @@ FROM alpine MAINTAINER kev -ENV SS_URL https://github.com/shadowsocks/shadowsocks-libev.git -ENV SS_DIR shadowsocks-libev -ENV SS_DEP pcre -ENV SS_BUILD_DEP git autoconf build-base curl libtool linux-headers openssl-dev asciidoc xmlto pcre-dev - -RUN set -ex \ - && apk add --update $SS_DEP $SS_BUILD_DEP\ - && git clone $SS_URL \ - && cd $SS_DIR \ - && ./configure \ - && make install \ - && cd .. \ - && rm -rf $SS_DIR \ - && apk del --purge $SS_BUILD_DEP \ - && rm -rf /var/cache/apk/* +ARG SS_VER=2.5.3 +ARG SS_URL=https://github.com/shadowsocks/shadowsocks-libev/archive/v$SS_VER.tar.gz ENV SERVER_ADDR 0.0.0.0 ENV SERVER_PORT 8388 @@ -29,8 +16,37 @@ ENV TIMEOUT 300 ENV DNS_ADDR 8.8.8.8 ENV DNS_ADDR_2 8.8.4.4 -EXPOSE $SERVER_PORT -EXPOSE $SERVER_PORT/udp +RUN set -ex && \ + apk add --no-cache --virtual .build-deps \ + asciidoc \ + autoconf \ + build-base \ + curl \ + libtool \ + linux-headers \ + openssl-dev \ + pcre-dev \ + tar \ + xmlto && \ + cd /tmp && \ + curl -sSL $SS_URL | tar xz --strip 1 && \ + ./configure --prefix=/usr --disable-documentation && \ + make install && \ + cd .. && \ + + runDeps="$( \ + scanelf --needed --nobanner /usr/bin/ss-* \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | xargs -r apk info --installed \ + | sort -u \ + )" && \ + apk add --no-cache --virtual .run-deps $runDeps && \ + apk del .build-deps && \ + rm -rf /tmp/* + +USER nobody + +EXPOSE $SERVER_PORT/tcp $SERVER_PORT/udp CMD ss-server -s $SERVER_ADDR \ -p $SERVER_PORT \ @@ -40,4 +56,6 @@ CMD ss-server -s $SERVER_ADDR \ --fast-open \ -d $DNS_ADDR \ -d $DNS_ADDR_2 \ --u + -U \ + -u +