Last active
November 23, 2024 10:33
-
-
Save Saluev/00a049853016c7999a764835b836ab5c to your computer and use it in GitHub Desktop.
Dockerfile for Ubuntu-based Bioconda environment on Apple Silicon (M1/M2/M3/M4) architecture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM --platform=linux/amd64 ubuntu:24.10 AS bioinf | |
# --platform specification here is crucial because as of now, | |
# without specifying it Docker starts building for ARM | |
# by default, which leads to "rosetta: failed to open elf" errors. | |
RUN apt-get update && apt-get install -y less vim wget | |
# Install other utilities of your liking. Specifically, if git is needed: | |
# RUN apt-get install git && mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts | |
# ssh-keyscan is invoked for git clone to work. Note that only GitHub will work now, change to required host. | |
# Installing miniconda | |
RUN mkdir -p /miniconda3 | |
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /miniconda3/miniconda.sh | |
RUN bash /miniconda3/miniconda.sh -b -u -p /miniconda3 && rm /miniconda3/miniconda.sh | |
RUN bash -c "source /miniconda3/bin/activate && conda init --all" | |
# All conda commands in the dockerfile should start with "bash -c "source ..."" | |
# part for Docker to see conda binary. | |
# Installing mamba | |
RUN bash -c "source /miniconda3/bin/activate && \ | |
conda install -y conda-forge::mamba" | |
# Installing bioconda | |
RUN bash -c "source /miniconda3/bin/activate && \ | |
conda config --add channels bioconda && \ | |
conda config --add channels conda-forge && \ | |
conda config --set channel_priority strict" | |
# Installing required tools | |
RUN bash -c "source /miniconda3/bin/activate && \ | |
mamba install -y bedtools samtools star" | |
# These tools are installed into the default conda env. | |
RUN bash -c "source /miniconda3/bin/activate && \ | |
mamba create -y --name cufflinks-env cufflinks" | |
# This tool is installed into its own conda env. | |
# (In this particular example, cufflinks requires | |
# too old version of Python to be compatible with | |
# other packages.) | |
VOLUME ["/data"] | |
WORKDIR /data | |
CMD ["bash"] | |
# Build: | |
# docker build -t bioinf --target bioinf . | |
# Run: | |
# docker run -it -v .:/data bioinf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment