unifi/images/mongo/Dockerfile

20 lines
758 B
Docker

FROM danielberteaud/alma:8
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
ARG MONGO_MAJOR=5.0
COPY root/ /
RUN set -eux &&\
sed -i -e "s/__MONGO_MAJOR__/${MONGO_MAJOR}/g" /etc/yum.repos.d/mongodb.repo &&\
microdnf -y --best --nodocs --noplugins --setopt=install_weak_deps=0 update &&\
# Create mongod user with same UID as mongodb in the official image \
groupadd -g 999 mongod &&\
useradd -M -r -g mongod -u 999 -d /var/lib/mongo -s /bin/false -c mongod mongod &&\
microdnf -y --nodocs --setopt=install_weak_deps=0 install tini mongodb-org-server mongodb-org-shell mongodb-org-tools &&\
microdnf clean all &&\
rm -rf /var/cache/yum/* /var/log/yum/* /var/lib/dnf/history*
USER mongod
ENTRYPOINT ["tini", "--"]
CMD ["mongod"]