forked from Acris/docker-shadowsocks-libev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (76 loc) · 2.33 KB
/
Dockerfile
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
FROM alpine
LABEL maintainer="Acris Liu <[email protected]>"
ENV SHADOWSOCKS_LIBEV_VERSION v3.3.2
# Build shadowsocks-libev
RUN set -ex \
# Install dependencies
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
build-base \
libev-dev \
libtool \
linux-headers \
udns-dev \
libsodium-dev \
mbedtls-dev \
pcre-dev \
tar \
udns-dev \
c-ares-dev \
git \
# Build shadowsocks-libev
&& mkdir -p /tmp/build-shadowsocks-libev \
&& cd /tmp/build-shadowsocks-libev \
&& git clone https://github.com/shadowsocks/shadowsocks-libev.git \
&& cd shadowsocks-libev \
&& git checkout "$SHADOWSOCKS_LIBEV_VERSION" \
&& git submodule update --init --recursive \
&& ./autogen.sh \
&& ./configure --disable-documentation \
&& make install \
&& ssRunDeps="$( \
scanelf --needed --nobanner /usr/local/bin/ss-server \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --no-cache --virtual .ss-rundeps $ssRunDeps \
&& cd / \
&& rm -rf /tmp/build-shadowsocks-libev \
# Delete dependencies
&& apk del .build-deps
# Copy v2ray-plugin
COPY --from=golang /go/src/github.com/shadowsocks/v2ray-plugin/v2ray-plugin /usr/local/bin
# Shadowsocks environment variables
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD ChangeMe!!!
ENV METHOD chacha20-ietf-poly1305
ENV TIMEOUT 86400
ENV DNS_ADDRS 1.1.1.1,1.0.0.1
ENV ARGS -u
EXPOSE $SERVER_PORT/tcp $SERVER_PORT/udp
# Start shadowsocks-libev server
CMD exec ss-server \
-s $SERVER_ADDR \
-p $SERVER_PORT \
-k $PASSWORD \
-m $METHOD \
-t $TIMEOUT \
-d $DNS_ADDRS \
--reuse-port \
--no-delay \
$ARGS