Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit 5a6b004

Browse files
authored
chore(Dockerfile): cleanup after installation a bit more than before and keep copyright / license files (#262)
1 parent d857f45 commit 5a6b004

1 file changed

Lines changed: 57 additions & 49 deletions

File tree

rootfs/Dockerfile

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,63 @@ RUN adduser --system \
99

1010
COPY /bin /bin
1111

12-
RUN apt-get update \
13-
&& apt-get install -y \
14-
gcc \
15-
libgeoip1 \
16-
libgeoip-dev \
17-
libssl-dev \
18-
libpcre3-dev \
19-
make \
20-
&& export NGINX_VERSION=1.11.4 SIGNING_KEY=A1C052F8 VTS_VERSION=0.1.10 BUILD_PATH=/tmp/build PREFIX=/opt/router \
21-
&& rm -rf "$PREFIX" \
22-
&& mkdir "$PREFIX" \
23-
&& mkdir "$BUILD_PATH" \
24-
&& cd "$BUILD_PATH" \
25-
&& get_src_gpg $SIGNING_KEY \
26-
"http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz" \
27-
&& get_src c6f3733e9ff84bfcdc6bfb07e1baf59e72c4e272f06964dd0ed3a1bdc93fa0ca \
28-
"https://github.com/vozlt/nginx-module-vts/archive/v$VTS_VERSION.tar.gz" \
29-
&& cd "$BUILD_PATH/nginx-$NGINX_VERSION" \
30-
&& ./configure \
31-
--prefix="$PREFIX" \
32-
--pid-path=/tmp/nginx.pid \
33-
--with-debug \
34-
--with-pcre-jit \
35-
--with-ipv6 \
36-
--with-http_ssl_module \
37-
--with-http_stub_status_module \
38-
--with-http_realip_module \
39-
--with-http_auth_request_module \
40-
--with-http_addition_module \
41-
--with-http_dav_module \
42-
--with-http_geoip_module \
43-
--with-http_gzip_static_module \
44-
--with-http_sub_module \
45-
--with-http_v2_module \
46-
--with-mail \
47-
--with-mail_ssl_module \
48-
--with-stream \
49-
--add-module="$BUILD_PATH/nginx-module-vts-$VTS_VERSION" \
50-
&& make \
51-
&& make install \
52-
&& apt-get remove -y --auto-remove --purge \
53-
gcc \
54-
libgeoip-dev \
55-
libssl-dev \
56-
libpcre3-dev \
57-
make \
58-
&& apt-get clean \
59-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc \
60-
&& rm -rf "$BUILD_PATH"
12+
RUN buildDeps='gcc make libgeoip-dev libssl-dev libpcre3-dev'; \
13+
apt-get update && \
14+
apt-get install -y --no-install-recommends \
15+
$buildDeps \
16+
libgeoip1 && \
17+
export NGINX_VERSION=1.11.4 SIGNING_KEY=A1C052F8 VTS_VERSION=0.1.10 BUILD_PATH=/tmp/build PREFIX=/opt/router && \
18+
rm -rf "$PREFIX" && \
19+
mkdir "$PREFIX" && \
20+
mkdir "$BUILD_PATH" && \
21+
cd "$BUILD_PATH" && \
22+
get_src_gpg $SIGNING_KEY "http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz" && \
23+
get_src c6f3733e9ff84bfcdc6bfb07e1baf59e72c4e272f06964dd0ed3a1bdc93fa0ca "https://github.com/vozlt/nginx-module-vts/archive/v$VTS_VERSION.tar.gz" && \
24+
cd "$BUILD_PATH/nginx-$NGINX_VERSION" && \
25+
./configure \
26+
--prefix="$PREFIX" \
27+
--pid-path=/tmp/nginx.pid \
28+
--with-debug \
29+
--with-pcre-jit \
30+
--with-ipv6 \
31+
--with-http_ssl_module \
32+
--with-http_stub_status_module \
33+
--with-http_realip_module \
34+
--with-http_auth_request_module \
35+
--with-http_addition_module \
36+
--with-http_dav_module \
37+
--with-http_geoip_module \
38+
--with-http_gzip_static_module \
39+
--with-http_sub_module \
40+
--with-http_v2_module \
41+
--with-mail \
42+
--with-mail_ssl_module \
43+
--with-stream \
44+
--add-module="$BUILD_PATH/nginx-module-vts-$VTS_VERSION" && \
45+
make && \
46+
make install && \
47+
rm -rf "$BUILD_PATH" && \
48+
# cleanup
49+
apt-get purge -y --auto-remove $buildDeps && \
50+
apt-get autoremove -y && \
51+
apt-get clean -y && \
52+
# package up license files if any by appending to existing tar
53+
COPYRIGHT_TAR='/usr/share/copyrights.tar'; \
54+
gunzip $COPYRIGHT_TAR.gz; tar -rf $COPYRIGHT_TAR /usr/share/doc/*/copyright; gzip $COPYRIGHT_TAR && \
55+
rm -rf \
56+
/usr/share/doc \
57+
/usr/share/man \
58+
/usr/share/info \
59+
/usr/share/locale \
60+
/var/lib/apt/lists/* \
61+
/var/log/* \
62+
/var/cache/debconf/* \
63+
/etc/systemd \
64+
/lib/lsb \
65+
/lib/udev \
66+
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
67+
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
68+
bash -c "mkdir -p /usr/share/man/man{1..8}"
6169

6270
COPY . /
6371

0 commit comments

Comments
 (0)