-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (65 loc) · 2.08 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
# build v2ray-plugin
FROM golang:1.16-alpine AS v2ray
# for some network
# ENV GOPROXY="https://proxy.golang.com.cn,direct"
RUN set -ex \
#&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
&& apk add --no-cache --virtual .go-deps\
git \
bash \
&& go get github.com/shadowsocks/v2ray-plugin\
&& apk del .go-deps
# use apline instead of alpine:3.9 will cause configure failure
FROM alpine:3.9 AS builder
LABEL maintainer="kev <[email protected]>, Sah <[email protected]>"
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD=
ENV METHOD aes-256-gcm
ENV TIMEOUT 300
ENV DNS_ADDRS 8.8.8.8,8.8.4.4
ENV TZ UTC
ENV ARGS=
WORKDIR ss-libev
RUN set -ex \
# Build environment setup
#&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
build-base \
c-ares-dev \
libcap \
libev-dev \
libtool \
libsodium-dev \
linux-headers \
mbedtls-dev \
pcre-dev \
git\
# git clone
# && git config --global .url."https://hub.fastgit.xyz/". insteadOf https://github.com/ \
&& git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git \
&& cd shadowsocks-libev \
# Build & install
&& ./autogen.sh \
&& ./configure --prefix=/usr --disable-documentation \
&& make install \
&& ls /usr/bin/ss-* | xargs -n1 setcap cap_net_bind_service+ep \
&& apk del .build-deps \
# Runtime dependencies setup
&& apk add --no-cache \
ca-certificates \
rng-tools \
tzdata \
$(scanelf --needed --nobanner /usr/bin/ss-* \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u) \
&& mkdir plugins \
&& rm -rf /ss-libev/shadowsocks-libev
USER nobody
ADD server-config.json .
COPY --from=v2ray /go/bin/v2ray-plugin ./plugins/
# or use command-line instead of config-file
# CMD ss-server -s $SERVER_ADDR -p $SERVER_PORT -m $METHOD --plugin /ss-libev/plugins/v2ray-plugin --plugin-opts "server"
CMD ss-server -c /ss-libev/server-config.json