FROM python:3.10.15-slim

Install necessary dependencies

RUN apt-get update && apt-get install -y python3-venv

Set up the virtual environment

ARG PYTHON_VERSION=3.10 RUN python3 -m venv /PYTHON-$PYTHON_VERSION &&
/PYTHON-$PYTHON_VERSION/bin/pip install --upgrade pip

Install Poetry in the virtual environment

RUN /PYTHON-$PYTHON_VERSION/bin/pip install 'poetry==1.5.1'

Ensure the virtual environment is used for subsequent commands

ENV PATH="/PYTHON-$PYTHON_VERSION/bin:$PATH"

build essential

RUN apt-get update && apt-get install -y
libpq-dev git curl wget nano which
libcurl4-openssl-dev
build-essential &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*

Additional setup steps (like MongoDB setup) can follow

RUN mkdir /build WORKDIR /build

RUN git clone https://github.com/mongodb/mongo.git

WORKDIR /build/mongo

RUN git checkout r8.0.1

RUN python3 -m pip install 'poetry==1.5.1' RUN export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring RUN python3 -m poetry install --no-root --sync

RUN python3 -m poetry add mongo_tooling_metrics

RUN python3 -m pip install mongo_tooling_metrics RUN python3 -m pip install psutil RUN python3 -m pip install pyyaml RUN python3 -m pip install retry RUN python3 -m pip install Cheetah3

RUN python3 buildscripts/scons.py install-core -j4 --ssl --linker=gold CFLAGS="-march=armv8-a+crc -mtune='cortex-a73.cortex-a53' " --disable-warnings-as-errors

-j n where n is CPU numbers

Command to run when starting the container

CMD ["bash"]

docker build -f Dockerfile-python-3.10.15-slim --tag python3.10.15:noble ./ --no-cache

docker run -it python3.10.15:noble