Created
September 28, 2021 09:36
-
-
Save harish0201/b939048b0bbcb88585676657a2767dd0 to your computer and use it in GitHub Desktop.
Conda+Docker for running clusterProfiler
This file contains 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
# The build-stage image: | |
FROM continuumio/miniconda3 AS build | |
# Install the package as normal: | |
COPY environment.yml ClusterProfiler_Enrichment.R / | |
RUN conda install -y -c conda-forge mamba && mamba env create -f environment.yml | |
# Install conda-pack | |
# Use conda-pack to create a standalone enviornment | |
# in /venv: | |
RUN mamba install -y -c conda-forge conda-pack && conda-pack -n clusterprofiler -o /tmp/env.tar && \ | |
mkdir /venv && mv ClusterProfiler_Enrichment.R /venv && cd /venv && tar xf /tmp/env.tar && \ | |
rm /tmp/env.tar && /venv/bin/conda-unpack && mkdir -p /data/in /data/out | |
# We've put venv in same path it'll be in final image, | |
# so now fix up paths: | |
#RUN /venv/bin/conda-unpack | |
# The runtime-stage image; we can use Debian as the | |
# base image since the Conda env also includes Python | |
# for us. | |
FROM debian:buster AS runtime | |
# Copy /venv from the previous stage: | |
COPY --from=build /venv /venv | |
# When image is run, run the code with the environment | |
# activated: | |
SHELL ["/bin/bash", "-c"] | |
ENV PATH=$PATH:/data/ | |
ENTRYPOINT source /venv/bin/activate && \ | |
Rscript /venv/ClusterProfiler_Enrichment.R | |
######################################## | |
where enviroment.yml is as such: | |
name: clusterprofiler | |
channels: | |
- conda-forge | |
- bioconda | |
dependencies: | |
- conda-forge::mamba | |
- bioconda::bioconductor-clusterprofiler | |
- bioconda::bioconductor-org.hs.eg.db | |
- bioconda::bioconductor-org.mm.eg.db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment