Skip to content

Commit

Permalink
Merge pull request #637 from DeepRank/529_fix_dockerfile_add_test_gcr…
Browse files Browse the repository at this point in the history
…oci2

fix: dockerfile image build
  • Loading branch information
gcroci2 authored Sep 6, 2024
2 parents 3a4942f + 928c67b commit 128d5f9
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
# 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
if [ -d "/home/deeprank2/tutorials/data_raw" ]; then rm -Rf /home/deeprank2/tutorials/data_raw; fi && \
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

Expand Down

0 comments on commit 128d5f9

Please sign in to comment.