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.

62 lines
1.6 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.0
  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. openssl-dev \
  27. pcre-dev \
  28. tar \
  29. udns-dev && \
  30. cd /tmp && \
  31. curl -sSL $SS_URL | tar xz --strip 1 && \
  32. ./configure --prefix=/usr --disable-documentation && \
  33. make install && \
  34. cd .. && \
  35. runDeps="$( \
  36. scanelf --needed --nobanner /usr/bin/ss-* \
  37. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  38. | xargs -r apk info --installed \
  39. | sort -u \
  40. )" && \
  41. apk add --no-cache --virtual .run-deps $runDeps && \
  42. apk del .build-deps && \
  43. rm -rf /tmp/*
  44. USER nobody
  45. EXPOSE $SERVER_PORT/tcp $SERVER_PORT/udp
  46. CMD ss-server -s $SERVER_ADDR \
  47. -p $SERVER_PORT \
  48. -k ${PASSWORD:-$(hostname)} \
  49. -m $METHOD \
  50. -t $TIMEOUT \
  51. --fast-open \
  52. -d $DNS_ADDR \
  53. -d $DNS_ADDR_2 \
  54. -u