diff --git a/Dockerfile b/Dockerfile index c2a84df3..98d7eb80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,35 @@ # Pull base image -FROM --platform=linux/x86_64 condaforge/miniforge3:23.3.1-1 +FROM --platform=linux/amd64 ubuntu:22.04 + +ARG MINIFORGE_NAME=Miniforge3 +ARG MINIFORGE_VERSION=24.3.0-0 +ARG TARGETPLATFORM + +ENV CONDA_DIR=/opt/conda +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV PATH=${CONDA_DIR}/bin:${PATH} + +RUN \ + ## Install apt dependencies + apt-get update && \ + apt-get install --no-install-recommends --yes \ + wget bzip2 unzip ca-certificates \ + git && \ + ## Download and install Miniforge + wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/${MINIFORGE_NAME}-${MINIFORGE_VERSION}-Linux-x86_64.sh -O /tmp/miniforge.sh && \ + /bin/bash /tmp/miniforge.sh -b -p ${CONDA_DIR} && \ + rm /tmp/miniforge.sh && \ + echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> /etc/skel/.bashrc && \ + echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> ~/.bashrc -# Add files -ADD ./tutorials /home/deeprank2/tutorials ADD ./env/deeprank2.yml /home/deeprank2 RUN \ - # Install dependencies and package - apt update -y && \ - apt install unzip -y && \ - ## GCC - apt install -y gcc && \ ## Create the environment and install the dependencies mamba env create -f /home/deeprank2/deeprank2.yml && \ + conda install -n deeprank2 conda-forge::gcc && \ ## Activate the environment and install pip packages - /opt/conda/bin/conda run -n deeprank2 pip install deeprank2 && \ + conda run -n deeprank2 pip install deeprank2 && \ ## Activate the environment automatically when entering the container echo "source activate deeprank2" >~/.bashrc && \ # Get the data for running the tutorials @@ -22,7 +37,15 @@ RUN \ if [ -d "/home/deeprank2/tutorials/data_processed" ]; then rm -Rf /home/deeprank2/tutorials/data_processed; fi && \ wget https://zenodo.org/records/8349335/files/data_raw.zip && \ unzip data_raw.zip -d data_raw && \ - mv data_raw /home/deeprank2/tutorials + mv data_raw /home/deeprank2/tutorials && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + conda clean --tarballs --index-cache --packages --yes && \ + find ${CONDA_DIR} -follow -type f -name '*.a' -delete && \ + find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete && \ + conda clean --force-pkgs-dirs --all --yes + +ADD ./tutorials /home/deeprank2/tutorials ENV PATH /opt/conda/envs/deeprank2/bin:$PATH