My major problem was that I have a machine with a restrictive chipset for running “normal” MongoDB. In my case, I required running MongoDB without AVX instructions. Usually, I compile MongoDB from scratch using a different repository for that purpose. However, when MongoDB upgraded to version > 7.0 and incorporated Poetry, it became really embarrassing to build MongoDB.
I don’t understand why poetry.lock is more updated than pyproject.toml when running:
RUN python3 -m poetry install --no-root --sync
I encounter this problem:
ModuleNotFoundError: No module named 'mongo_tooling_metrics':
File "/src/SConstruct", line 28:
from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
The command '/bin/sh -c python3 buildscripts/scons.py install-mongod --disable-warnings-as-errors' returned a non-zero code: 2
If I watch poetry.lock, I find it in this file but not in pyproject.toml.
poetry.lock
[[package]]
name = "mongo-tooling-metrics"
version = "1.0.8"
description = "A slim library which leverages Pydantic to reliably collect type enforced metrics and store them to MongoDB."
optional = false
python-versions = ">=3.7,<4.0"
files = [
{file = "mongo_tooling_metrics-1.0.8-py3-none-any.whl", hash = "sha256:6f022c07e55bedd06c9fbb19daf4118b38ac1bc290c9a645b5c1ef39cf905003"},
{file = "mongo_tooling_metrics-1.0.8.tar.gz", hash = "sha256:1f10712b237a8c99551a4b63ce4e62db42aca05ef6d054af728b55081dd477d4"},
]
Finally, if there is any human generosity, please help me to create a Dockerfile for my cause.
FROM debian:11 as build
RUN apt update -y && apt install -y build-essential \
libcurl4-openssl-dev \
liblzma-dev \
libssl-dev \
python-dev-is-python3 \
python3-pip \
curl \
wget \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
ARG MONGO_VERSION=7.2.0
RUN mkdir /src && \
curl -o /tmp/mongo.tar.gz -L "https://github.com/mongodb/mongo/archive/refs/tags/r${MONGO_VERSION}.tar.gz" && \
tar xaf /tmp/mongo.tar.gz --strip-components=1 -C /src && \
rm /tmp/mongo.tar.gz
WORKDIR /src
COPY ./o2_patch.diff /o2_patch.diff
RUN patch -p1 < /o2_patch.diff
ARG NUM_JOBS=1
RUN python3 -m pip install 'poetry==1.5.1'
RUN python3 -m poetry install --no-root --sync
#RUN export GIT_PYTHON_REFRESH=quiet
RUN python3 buildscripts/scons.py install-mongod --disable-warnings-as-errors
RUN mv build/install /install
RUN strip --strip-debug /install/bin/mongod
RUN strip --strip-debug /install/bin/mongos
RUN rm -rf build
FROM debian:11
RUN apt update -y && \
apt install -y libcurl4 && \
apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /install/bin/mongo* /usr/local/bin/
RUN mkdir -p /data/db && \
chmod -R 750 /data && \
chown -R 999:999 /data
USER 999
ENTRYPOINT [ "/usr/local/bin/mongod" ]