summaryrefslogtreecommitdiff
path: root/data/mongodb_container/Dockerfile
blob: 32ee43bf0012847ebbd871ff4d8fbd43964c5237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM debian:bullseye-20221024-slim@sha256:76cdda8fe5eb597ef5e712e4c9a9f5f1fb119e69f353daaa7bd6d0f6e66e541d

EXPOSE 27017

RUN apt-get update && apt-get install curl -y \
  && curl -fsSL https://pgp.mongodb.com/server-6.0.pub | tee /usr/share/keyrings/mongodb-archive-keyring.gpg > /dev/null \
  && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list \
  && apt-get update \
  && apt-get install \
  mongodb-org -y \
  && apt-get remove -y \
  wget \
  curl \
  && apt-get autoremove -y \
  && apt-get clean

# Remove setuid and setgid
RUN find / -xdev -perm /6000 -type f -exec chmod a-s {} \; || true

COPY ./data/mongodb_entrypoint.sh /mongodb_entrypoint.sh
COPY ./data/init-mongodb.js /init-mongodb.js

USER mongodb

WORKDIR /data/db

ENTRYPOINT ["bash", "/mongodb_entrypoint.sh"]