Skip to content

Commit a405213

Browse files
committed
Update Dockerfile to use system libraries and manually strip binaries to avoid 14GB image layers
1 parent 86757d7 commit a405213

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

Dockerfile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,36 @@ FROM debian:jessie
22

33
RUN apt-get update && apt-get install -y build-essential scons libssl-dev
44

5+
# "--use-system" deps
6+
RUN apt-get update && apt-get install -y \
7+
libboost-dev \
8+
libboost-filesystem-dev \
9+
libboost-program-options-dev \
10+
libboost-thread-dev \
11+
libgoogle-perftools-dev \
12+
libpcap-dev \
13+
libpcre++-dev \
14+
libsnappy-dev \
15+
libstemmer-dev \
16+
libv8-dev
17+
ENV SCONS_OPTS --use-system-snappy --use-system-tcmalloc --use-system-pcre --use-system-boost --use-system-v8 --ssl
18+
519
ADD . /usr/src/mongo
620
WORKDIR /usr/src/mongo
721

8-
RUN scons -j"$(nproc)" core tools
22+
# the unstripped binaries and build artifacts are enormous, so we strip and
23+
# remove them manually to help alleviate that huge layer being an issue
24+
RUN scons -j"$(nproc)" $SCONS_OPTS core tools \
25+
&& find -maxdepth 1 -type f -executable -exec strip '{}' + \
26+
&& rm -rf build
927

1028
# the tests compile huge amounts of data, so we skip them for now
11-
#RUN scons test
29+
#RUN scons $SCONS_OPTS test
1230

13-
RUN scons install
31+
# since we're stripping and removing build artifacts, we get to install
32+
# manually too (since scons rightfully thinks we need to rebuild)
33+
#RUN scons $SCONS_OPTS install
34+
RUN find -maxdepth 1 -type f -executable -exec ln -v '{}' /usr/local/bin/ ';'
1435

1536
VOLUME /data/db
1637

0 commit comments

Comments
 (0)