You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB

7 years ago
  1. #
  2. # Dockerfile for shadowsocks-libev
  3. #
  4. FROM alpine
  5. MAINTAINER kev <noreply@datageek.info>
  6. ARG SS_VER=3.0.3
  7. ARG SS_URL=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$SS_VER/shadowsocks-libev-$SS_VER.tar.gz
  8. ENV SERVER_ADDR 0.0.0.0
  9. ENV SERVER_PORT 8388
  10. ENV PASSWORD=
  11. ENV METHOD aes-256-cfb
  12. ENV TIMEOUT 300
  13. ENV DNS_ADDR 8.8.8.8
  14. ENV DNS_ADDR_2 8.8.4.4
  15. RUN set -ex && \
  16. apk add --no-cache --virtual .build-deps \
  17. autoconf \
  18. build-base \
  19. curl \
  20. libev-dev \
  21. libtool \
  22. linux-headers \
  23. udns-dev \
  24. libsodium-dev \
  25. mbedtls-dev \
  26. pcre-dev \
  27. tar \
  28. udns-dev && \
  29. cd /tmp && \
  30. curl -sSL $SS_URL | tar xz --strip 1 && \
  31. ./configure --prefix=/usr --disable-documentation && \
  32. make install && \
  33. cd .. && \
  34. runDeps="$( \
  35. scanelf --needed --nobanner /usr/bin/ss-* \
  36. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  37. | xargs -r apk info --installed \
  38. | sort -u \
  39. )" && \
  40. apk add --no-cache --virtual .run-deps $runDeps && \
  41. apk del .build-deps && \
  42. rm -rf /tmp/*
  43. USER nobody
  44. EXPOSE $SERVER_PORT/tcp $SERVER_PORT/udp
  45. CMD ss-server -s $SERVER_ADDR \
  46. -p $SERVER_PORT \
  47. -k ${PASSWORD:-$(hostname)} \
  48. -m $METHOD \
  49. -t $TIMEOUT \
  50. --fast-open \
  51. -d $DNS_ADDR \
  52. -d $DNS_ADDR_2 \
  53. -u