-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (76 loc) · 2.5 KB
/
Dockerfile
File metadata and controls
86 lines (76 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
FROM golang:alpine AS golang
ENV V2RAY_PLUGIN_VERSION v1.2.0
ENV GO111MODULE on
# Build v2ray-plugin
RUN apk add --no-cache git build-base \
&& mkdir -p /go/src/github.com/shadowsocks \
&& cd /go/src/github.com/shadowsocks \
&& git clone https://github.com/shadowsocks/v2ray-plugin.git \
&& cd v2ray-plugin \
&& git checkout "$V2RAY_PLUGIN_VERSION" \
&& go get -d \
&& go build
# Shadowsocks Server Dockerfile
FROM alpine
ARG SS_VER=3.3.3
ARG SS_DOWNLOAD=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SS_VER}/shadowsocks-libev-${SS_VER}.tar.gz
ARG OBFS_DOWNLOAD=https://github.com/shadowsocks/simple-obfs.git
RUN set -ex && apk upgrade \
&& apk add bash tzdata rng-tools \
&& apk add --no-cache --virtual .build-deps \
gcc \
make \
openssl \
libpcre32 \
g++ \
curl \
autoconf \
build-base \
libtool \
linux-headers \
libressl-dev \
zlib-dev \
asciidoc \
udns-dev \
xmlto \
pcre-dev \
automake \
mbedtls-dev \
libsodium-dev \
c-ares-dev \
libev-dev \
tar \
git \
&& curl -fsSL ${SS_DOWNLOAD} | tar xz \
&& (cd shadowsocks-libev-${SS_VER} \
&& ./configure --prefix=/usr --disable-documentation \
&& make install) \
&& git clone ${OBFS_DOWNLOAD} \
&& (cd simple-obfs \
&& git submodule update --init --recursive \
&& ./autogen.sh && ./configure --prefix=/usr --disable-documentation\
&& make && make install) \
&& cd .. \
&& runDeps="$( \
scanelf --needed --nobanner /usr/bin/ss-* /usr/local/bin/obfs-* \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .run-deps $runDeps \
&& apk del .build-deps \
&& rm -rf shadowsocks-libev-${SS_VER}.tar.gz \
shadowsocks-libev-${SS_VER} \
simple-obfs \
/var/cache/apk/*
# Copy v2ray-plugin
COPY --from=golang /go/src/github.com/shadowsocks/v2ray-plugin/v2ray-plugin /usr/local/bin
ENV SS_PORT 8388
ENV PASSWORD ChangeMe!!!
ENV SS_METHOD chacha20-ietf-poly1305
ENV SS_TIMEOUT 60
ENV DNS_ADDR 1.1.1.1,1.0.0.1
ENV PLUGIN=obfs-server
ENV PLUGIN_OPTS obfs=tls;fast-open;failover=0.0.0.0:8443
EXPOSE $SS_PORT/tcp $SS_PORT/udp
ENTRYPOINT ss-server -p $SS_PORT -k $PASSWORD -m $SS_METHOD -t $SS_TIMEOUT -d $DNS_ADDR --plugin $PLUGIN --plugin-opts $PLUGIN_OPTS -u --fast-open --no-delay