Skip to content

Commit 8f5e7ac

Browse files
authored
Merge pull request #391 from infosiftr/4.3
Add MongoDB 4.3 (development release)
2 parents 3ec50f2 + 3fecc7f commit 8f5e7ac

File tree

7 files changed

+592
-2
lines changed

7 files changed

+592
-2
lines changed

4.4-rc/Dockerfile

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
FROM ubuntu:bionic
2+
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 set -eux; \
7+
apt-get update; \
8+
apt-get install -y --no-install-recommends \
9+
ca-certificates \
10+
jq \
11+
numactl \
12+
; \
13+
if ! command -v ps > /dev/null; then \
14+
apt-get install -y --no-install-recommends procps; \
15+
fi; \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
# grab gosu for easy step-down from root (https://github.com/tianon/gosu/releases)
19+
ENV GOSU_VERSION 1.12
20+
# grab "js-yaml" for parsing mongod's YAML config files (https://github.com/nodeca/js-yaml/releases)
21+
ENV JSYAML_VERSION 3.13.1
22+
23+
RUN set -ex; \
24+
\
25+
savedAptMark="$(apt-mark showmanual)"; \
26+
apt-get update; \
27+
apt-get install -y --no-install-recommends \
28+
wget \
29+
; \
30+
if ! command -v gpg > /dev/null; then \
31+
apt-get install -y --no-install-recommends gnupg dirmngr; \
32+
savedAptMark="$savedAptMark gnupg dirmngr"; \
33+
elif gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
34+
# "This package provides support for HKPS keyservers." (GnuPG 1.x only)
35+
apt-get install -y --no-install-recommends gnupg-curl; \
36+
fi; \
37+
rm -rf /var/lib/apt/lists/*; \
38+
\
39+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
40+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
41+
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
42+
export GNUPGHOME="$(mktemp -d)"; \
43+
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
44+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
45+
command -v gpgconf && gpgconf --kill all || :; \
46+
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
47+
\
48+
wget -O /js-yaml.js "https://github.com/nodeca/js-yaml/raw/${JSYAML_VERSION}/dist/js-yaml.js"; \
49+
# TODO some sort of download verification here
50+
\
51+
apt-mark auto '.*' > /dev/null; \
52+
apt-mark manual $savedAptMark > /dev/null; \
53+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
54+
\
55+
# smoke test
56+
chmod +x /usr/local/bin/gosu; \
57+
gosu --version; \
58+
gosu nobody true
59+
60+
RUN mkdir /docker-entrypoint-initdb.d
61+
62+
ENV GPG_KEYS 99DC630F00A2F97F27C6A02A253612A09571B484 20691EEC35216C63CAF66CE1656408E390CFB1F5 E162F504A20CDF15827F718D4B7C549A058F8B6B 9DA31620334BD75D9DCB49F368818C72E52529D4 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
63+
RUN set -ex; \
64+
export GNUPGHOME="$(mktemp -d)"; \
65+
for key in $GPG_KEYS; do \
66+
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
67+
done; \
68+
gpg --batch --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mongodb.gpg; \
69+
command -v gpgconf && gpgconf --kill all || :; \
70+
rm -r "$GNUPGHOME"; \
71+
apt-key list
72+
73+
# Allow build-time overrides (eg. to build image with MongoDB Enterprise version)
74+
# Options for MONGO_PACKAGE: mongodb-org OR mongodb-enterprise
75+
# Options for MONGO_REPO: repo.mongodb.org OR repo.mongodb.com
76+
# Example: docker build --build-arg MONGO_PACKAGE=mongodb-enterprise --build-arg MONGO_REPO=repo.mongodb.com .
77+
ARG MONGO_PACKAGE=mongodb-org
78+
ARG MONGO_REPO=repo.mongodb.org
79+
ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO}
80+
81+
ENV MONGO_MAJOR testing
82+
ENV MONGO_VERSION 4.4.0~rc7
83+
# bashbrew-architectures:amd64 arm64v8 s390x
84+
RUN echo "deb http://$MONGO_REPO/apt/ubuntu bionic/${MONGO_PACKAGE%-unstable}/$MONGO_MAJOR multiverse" | tee "/etc/apt/sources.list.d/${MONGO_PACKAGE%-unstable}.list"
85+
86+
RUN set -x \
87+
# installing "mongodb-enterprise" pulls in "tzdata" which prompts for input
88+
&& export DEBIAN_FRONTEND=noninteractive \
89+
&& apt-get update \
90+
# starting with MongoDB 4.3, the postinst for server includes "systemctl daemon-reload" (and we don't have "systemctl")
91+
&& ln -s /bin/true /usr/local/bin/systemctl \
92+
&& apt-get install -y \
93+
${MONGO_PACKAGE}=$MONGO_VERSION \
94+
${MONGO_PACKAGE}-server=$MONGO_VERSION \
95+
${MONGO_PACKAGE}-shell=$MONGO_VERSION \
96+
${MONGO_PACKAGE}-mongos=$MONGO_VERSION \
97+
${MONGO_PACKAGE}-tools=$MONGO_VERSION \
98+
&& rm -f /usr/local/bin/systemctl \
99+
&& rm -rf /var/lib/apt/lists/* \
100+
&& rm -rf /var/lib/mongodb \
101+
&& mv /etc/mongod.conf /etc/mongod.conf.orig
102+
103+
RUN mkdir -p /data/db /data/configdb \
104+
&& chown -R mongodb:mongodb /data/db /data/configdb
105+
VOLUME /data/db /data/configdb
106+
107+
COPY docker-entrypoint.sh /usr/local/bin/
108+
ENTRYPOINT ["docker-entrypoint.sh"]
109+
110+
EXPOSE 27017
111+
CMD ["mongod"]

0 commit comments

Comments
 (0)