Browse Source
Merge pull request #2003 from leesah/master
Docker: optimizations
pull/2010/head
Max Lv
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
40 additions and
41 deletions
-
.dockerignore
-
docker/alpine/Dockerfile
|
|
@ -1,5 +1,7 @@ |
|
|
|
# General |
|
|
|
.dockerignore |
|
|
|
.git |
|
|
|
.gitmodules |
|
|
|
.gitignore |
|
|
|
.github |
|
|
|
AUTHORS |
|
|
|
|
|
@ -13,49 +13,46 @@ ENV DNS_ADDR 8.8.8.8 |
|
|
|
ENV DNS_ADDR_2 8.8.4.4 |
|
|
|
ENV ARGS= |
|
|
|
|
|
|
|
COPY . /tmp |
|
|
|
|
|
|
|
RUN set -ex && \ |
|
|
|
apk add --no-cache --virtual .build-deps \ |
|
|
|
git \ |
|
|
|
autoconf \ |
|
|
|
automake \ |
|
|
|
libtool \ |
|
|
|
build-base \ |
|
|
|
libev-dev \ |
|
|
|
linux-headers \ |
|
|
|
libsodium-dev \ |
|
|
|
mbedtls-dev \ |
|
|
|
pcre-dev \ |
|
|
|
c-ares-dev && \ |
|
|
|
cd /tmp && \ |
|
|
|
./autogen.sh && \ |
|
|
|
./configure --prefix=/usr --disable-documentation && \ |
|
|
|
make install && \ |
|
|
|
|
|
|
|
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 \ |
|
|
|
rng-tools \ |
|
|
|
$runDeps && \ |
|
|
|
apk del .build-deps && \ |
|
|
|
rm -rf /tmp/* |
|
|
|
COPY . /tmp/repo |
|
|
|
RUN set -ex \ |
|
|
|
# Build environment setup |
|
|
|
&& apk add --no-cache --virtual .build-deps \ |
|
|
|
autoconf \ |
|
|
|
automake \ |
|
|
|
build-base \ |
|
|
|
c-ares-dev \ |
|
|
|
libev-dev \ |
|
|
|
libtool \ |
|
|
|
libsodium-dev \ |
|
|
|
linux-headers \ |
|
|
|
mbedtls-dev \ |
|
|
|
pcre-dev \ |
|
|
|
# Build & install |
|
|
|
&& cd /tmp/repo \ |
|
|
|
&& ./autogen.sh \ |
|
|
|
&& ./configure --prefix=/usr --disable-documentation \ |
|
|
|
&& make install \ |
|
|
|
&& apk del .build-deps \ |
|
|
|
# Runtime dependencies setup |
|
|
|
&& apk add --no-cache \ |
|
|
|
rng-tools \ |
|
|
|
$(scanelf --needed --nobanner /usr/bin/ss-* \ |
|
|
|
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ |
|
|
|
| sort -u) \ |
|
|
|
&& rm -rf /tmp/repo |
|
|
|
|
|
|
|
USER nobody |
|
|
|
|
|
|
|
EXPOSE 8388/tcp 8388/udp |
|
|
|
|
|
|
|
CMD ss-server -s $SERVER_ADDR \ |
|
|
|
-p 8388 \ |
|
|
|
-k ${PASSWORD:-$(hostname)} \ |
|
|
|
-m $METHOD \ |
|
|
|
-t $TIMEOUT \ |
|
|
|
--fast-open \ |
|
|
|
-d $DNS_ADDR \ |
|
|
|
-d $DNS_ADDR_2 \ |
|
|
|
-u \ |
|
|
|
$ARGS |
|
|
|
CMD exec ss-server \ |
|
|
|
-s $SERVER_ADDR \ |
|
|
|
-p 8388 \ |
|
|
|
-k ${PASSWORD:-$(hostname)} \ |
|
|
|
-m $METHOD \ |
|
|
|
-t $TIMEOUT \ |
|
|
|
--fast-open \ |
|
|
|
-d $DNS_ADDR \ |
|
|
|
-d $DNS_ADDR_2 \ |
|
|
|
-u \ |
|
|
|
$ARGS |