FROM debian:bullseye-20221114-slim@sha256:df172d92d287ec4d4a538e5db8026fcde5f91f5f90061423d69d6148ff05cc47 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 COPY ./data/healthcheck-mongodb.js /healthcheck-mongodb.js COPY ./src/soc_collector/healthcheck.sh /healthcheck.sh USER mongodb WORKDIR /data/db # Add healthcheck HEALTHCHECK --interval=30s --timeout=15s --retries=1 --start-period=30s \ CMD sh /healthcheck.sh MONGODB || bash -c 'kill -s 15 1 && (sleep 7; kill -s 9 1)' ENTRYPOINT ["bash", "/mongodb_entrypoint.sh"]