Skip to content

Commit

Permalink
Update dockerfile and associated stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjmeier committed Oct 4, 2023
1 parent dd486f2 commit 588282a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 132 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
Dockerfile
58 changes: 23 additions & 35 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
########################################################
## Build R-ODAF container for transcriptomic analysis ##
########################################################
# Conda base image
FROM continuumio/miniconda3 as base
#:4.12.0 as base
# Mamba base image
FROM condaforge/mambaforge:23.3.1-1 as base
#continuumio/miniconda3 - difficult to install mamba, so switched away from this base

# Required to avoid interactive prompts
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -20,15 +20,16 @@ RUN apt-get update && apt-get -y install \
libcairo2-dev \
libxt-dev \
tree \
vim
gosu \
vim && \
mamba install -y -c conda-forge -c bioconda -n base snakemake && \
rm -rf /var/lib/apt/lists/* && \
gosu nobody true
# last line is to verify that gosu works

RUN mkdir -p /home/R-ODAF/R-ODAF_Health_Canada
WORKDIR "/home/R-ODAF/R-ODAF_Health_Canada"
COPY . .
RUN conda install 'mamba<=1.4.5' -n base -c conda-forge
RUN conda update mamba -n base -c conda-forge
#RUN conda install -n base -c conda-forge mamba
RUN mamba install -y -c conda-forge -c bioconda -n base snakemake
RUN chown -R R-ODAF:R-ODAF /home/R-ODAF
USER R-ODAF
RUN mv data data.bak && mv config config.bak
Expand All @@ -38,10 +39,15 @@ RUN git clone https://github.com/EHSRB-BSRSE-Bioinformatics/test-data \
&& wget https://github.com/EHSRB-BSRSE-Bioinformatics/unify_temposeq_manifests/raw/main/output_manifests/Human_S1500_1.2_standardized.csv

# Build environments with Snakemake
RUN snakemake --cores 32 --use-conda --conda-create-envs-only
RUN /bin/bash -c "snakemake --cores 32 --use-conda --conda-create-envs-only"

# Install extra dependency for reports
RUN conda run -p $(grep -rl "R-ODAF_reports" .snakemake/conda/*.yaml | sed s/\.yaml//) Rscript install.R
RUN /bin/bash -c "conda run -p $(grep -rl "R-ODAF_reports" .snakemake/conda/*.yaml | sed s/\.yaml//) Rscript install.R"

# Change ownership of files
USER root
RUN chown -R R-ODAF:R-ODAF /home/R-ODAF
USER R-ODAF

########################################################
## Build R-ODAF container for transcriptomic analysis ##
Expand All @@ -51,14 +57,10 @@ RUN conda run -p $(grep -rl "R-ODAF_reports" .snakemake/conda/*.yaml | sed s/\.y
# Note that if you alter any dependencies, the base container must be rebuilt
FROM base as tests

# Update code if it has changed in build context
COPY . .
USER root
RUN chown -R R-ODAF:R-ODAF /home/R-ODAF
USER R-ODAF

# Run tests
RUN /bin/bash -c "snakemake --cores 32 --use-conda"

# Clean up files
FROM tests as cleanup

# Clean up directories
Expand All @@ -72,29 +74,15 @@ RUN mkdir ./tests && \
data \
config \
./tests/
RUN sleep 1 && mv -vf "data.bak" "data" && \
mv -vf "config.bak" "config"
RUN /bin/bash -c "tree data.bak && tree config.bak && \
mv data.bak data && mv config.bak config"
# Move test files
USER root
RUN mv ./tests /opt/tests

########################################################
## Build R-ODAF container for transcriptomic analysis ##
########################################################
# From tested container with updated code
FROM cleanup

USER root

# Move files
RUN mv tests /opt/tests

# Install gosu
RUN set -eux; \
apt-get update; \
apt-get install -y gosu; \
rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true

COPY entrypoint.sh .
RUN ["chmod", "+x", "entrypoint.sh"]
ENTRYPOINT ["/home/R-ODAF/R-ODAF_Health_Canada/entrypoint.sh"]
#CMD ["/bin/bash" "-l"]
42 changes: 0 additions & 42 deletions Dockerfile.base

This file was deleted.

23 changes: 0 additions & 23 deletions Dockerfile.prod

This file was deleted.

29 changes: 0 additions & 29 deletions Dockerfile.tests

This file was deleted.

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- ./reference:/home/R-ODAF/R-ODAF_Health_Canada/reference
- ./wikipathways-20210810-gmt-Homo_sapiens.gmt:/home/R-ODAF/R-ODAF_Health_Canada/wikipathways-20210810-gmt-Homo_sapiens.gmt
- ./Human_S1500_1.2_standardized.csv:/home/R-ODAF/R-ODAF_Health_Canada/Human_S1500_1.2_standardized.csv
image: mattjmeier/r-odaf-hc-prod:latest
image: mattjmeier/r-odaf-hc:latest
# command: /bin/bash -l
environment:
- HOST_UID=10007
Expand All @@ -22,11 +22,11 @@ services:
rstudio:
image: rocker/tidyverse
restart: "unless-stopped"
container_name: rstudio-server
container_name: rstudio-server-odaf
volumes_from:
- r-odaf
ports:
- 8789:8787
- 8790:8787
environment:
- R_LIBS=${R_LIBS-'/usr/local/lib/R/site-library:/usr/local/lib/R/library'}
- PASSWORD=changeme
Expand Down
Empty file modified entrypoint.sh
100644 → 100755
Empty file.

0 comments on commit 588282a

Please sign in to comment.