ARG BASE_IMAGE

FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y \
  && apt-get install --no-install-recommends -y \
  wget nano build-essential git cmake python3-dev python3-pip pybind11-dev \
  libeigen3-dev libomp-dev ninja-build

RUN apt-get update && apt-get install --no-install-recommends -y \
  && apt-get install --no-install-recommends -y \
  clang lld

RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 50
ENV CC=clang
ENV CXX=clang++

RUN mkdir -p ~/.config/pip
RUN echo "[global]\nbreak-system-packages=true" > ~/.config/pip/pip.conf

RUN pip install pytest numpy scipy

COPY . /root/small_gicp

WORKDIR /root/small_gicp
RUN rm -rf build

RUN pip install .
RUN python3 -m pytest src/example/basic_registration.py
RUN python3 -m pytest src/test/python_test.py

WORKDIR /

CMD ["bash"]