Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dockerfile image build #637

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading