Skip to content

Instantly share code, notes, and snippets.

@longkai
Last active April 17, 2018 19:51
Show Gist options
  • Save longkai/207ef3551fc77d371c1a68ea81db9c6b to your computer and use it in GitHub Desktop.
Save longkai/207ef3551fc77d371c1a68ea81db9c6b to your computer and use it in GitHub Desktop.
shadowsocks-libev with simple obfs in a single docker image
#
# Dockerfile for shadowsocks-libev
#
FROM alpine
MAINTAINER longkai <[email protected]>
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD=
ENV METHOD aes-256-cfb
ENV TIMEOUT 300
ENV DNS_ADDR 8.8.8.8
ENV DNS_ADDR_2 8.8.4.4
RUN set -ex && \
apk add --no-cache --virtual .build-deps \
autoconf \
build-base \
libev-dev \
libtool \
linux-headers \
udns-dev \
libsodium-dev \
mbedtls-dev \
pcre-dev \
tar \
git \
automake \
udns-dev && \
cd /tmp && \
git clone --depth=1 https://github.com/shadowsocks/simple-obfs.git . && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure --prefix=/usr --disable-documentation && make && \
make install && \
cd .. && \
find /tmp -mindepth 1 -delete && \
cd /tmp && \
git clone --depth=1 https://github.com/shadowsocks/shadowsocks-libev.git . && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure --prefix=/usr --disable-documentation && make && \
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 \
-k ${PASSWORD:-$(hostname)} \
-m $METHOD \
-t $TIMEOUT \
--fast-open \
-d $DNS_ADDR \
-d $DNS_ADDR_2 \
-u \
--plugin obfs-server --plugin-opts "obfs=http"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment