11FROM debian:jessie
22
3- RUN apt-get update && apt-get install -y build-essential scons libssl-dev
3+ # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
4+ RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
5+
6+ RUN apt-get update && apt-get install -y \
7+ build-essential \
8+ curl \
9+ libssl-dev \
10+ scons
411
512# "--use-system" deps
613RUN apt-get update && apt-get install -y \
@@ -16,13 +23,16 @@ RUN apt-get update && apt-get install -y \
1623 libv8-dev
1724ENV SCONS_OPTS --use-system-snappy --use-system-tcmalloc --use-system-pcre --use-system-boost --use-system-v8 --ssl
1825
26+ RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.0/gosu' \
27+ && chmod +x /usr/local/bin/gosu
28+
1929ADD . /usr/src/mongo
2030WORKDIR /usr/src/mongo
2131
2232# the unstripped binaries and build artifacts are enormous, so we strip and
2333# remove them manually to help alleviate that huge layer being an issue
2434RUN scons -j"$(nproc)" $SCONS_OPTS core tools \
25- && find -maxdepth 1 -type f -executable -exec strip '{}' + \
35+ && find -maxdepth 1 -type f -executable -not -name '*.sh' - exec strip '{}' + \
2636 && rm -rf build
2737
2838# the tests compile huge amounts of data, so we skip them for now
@@ -31,9 +41,10 @@ RUN scons -j"$(nproc)" $SCONS_OPTS core tools \
3141# since we're stripping and removing build artifacts, we get to install
3242# manually too (since scons rightfully thinks we need to rebuild)
3343# RUN scons $SCONS_OPTS install
34- RUN find -maxdepth 1 -type f -executable -exec ln -v '{}' /usr/local/bin/ ';'
44+ RUN find -maxdepth 1 -type f -executable -not -name '*.sh' - exec ln -v '{}' /usr/local/bin/ ';'
3545
3646VOLUME /data/db
47+ ENTRYPOINT ["/usr/src/mongo/docker-entrypoint.sh" ]
3748
38- EXPOSE 27017 28017
49+ EXPOSE 27017
3950CMD ["mongod" ]
0 commit comments