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.

59 lines
1.3 KiB

  1. #
  2. # Dockerfile for shadowsocks-libev
  3. #
  4. FROM alpine
  5. LABEL maintainer="kev <noreply@datageek.info>, Sah <contact@leesah.name>"
  6. ENV SERVER_ADDR 0.0.0.0
  7. ENV SERVER_PORT 8388
  8. ENV PASSWORD=
  9. ENV METHOD aes-256-gcm
  10. ENV TIMEOUT 300
  11. ENV DNS_ADDRS 8.8.8.8,8.8.4.4
  12. ENV TZ UTC
  13. ENV ARGS=
  14. COPY . /tmp/repo
  15. RUN set -ex \
  16. # Build environment setup
  17. && apk add --no-cache --virtual .build-deps \
  18. autoconf \
  19. automake \
  20. build-base \
  21. c-ares-dev \
  22. libcap \
  23. libev-dev \
  24. libtool \
  25. libsodium-dev \
  26. linux-headers \
  27. mbedtls-dev \
  28. pcre-dev \
  29. # Build & install
  30. && cd /tmp/repo \
  31. && ./autogen.sh \
  32. && ./configure --prefix=/usr --disable-documentation \
  33. && make install \
  34. && ls /usr/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \
  35. && apk del .build-deps \
  36. # Runtime dependencies setup
  37. && apk add --no-cache \
  38. ca-certificates \
  39. rng-tools \
  40. tzdata \
  41. $(scanelf --needed --nobanner /usr/bin/ss-* \
  42. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  43. | sort -u) \
  44. && rm -rf /tmp/repo
  45. USER nobody
  46. CMD exec ss-server \
  47. -s $SERVER_ADDR \
  48. -p $SERVER_PORT \
  49. -k ${PASSWORD:-$(hostname)} \
  50. -m $METHOD \
  51. -t $TIMEOUT \
  52. -d $DNS_ADDRS \
  53. -u \
  54. $ARGS