# IMPORTANT: Use .. for the Build Context https://docs.docker.com/build/building/context/
# i.e. `sudo docker build ... -f Dockerfile ..`
FROM redhat/ubi9-minimal
# NOTE: the package manager is microdnf, not dnf

# Install conda / mamba
RUN microdnf update -y && microdnf install -y wget

ARG CONDA="Miniforge3-Linux-x86_64.sh"

RUN wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/$CONDA && \
    chmod +x $CONDA && \
    ./$CONDA -b -p /miniforge && \
    rm -f $CONDA
ENV PATH /miniforge/bin:$PATH

# Install Sophios
RUN microdnf install -y git

COPY . /sophios
WORKDIR /sophios

RUN mamba env update --name base --file install/system_deps.yml
RUN pip install -e ".[all_except_runner_src]"

RUN mamba clean --all --yes
RUN pip cache purge
RUN microdnf clean all

ADD docker/Dockerfile_redhat .
