Skip to content

Commit

Permalink
replace dockerfile with contents of dockerfile.new, build with docker…
Browse files Browse the repository at this point in the history
…file (#250)
  • Loading branch information
LMBradford authored Jun 14, 2024
1 parent cb6faaf commit 86dd7ef
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
push: true
output: true
tags: ghcr.io/r-odaf/r-odaf_health_canada:r-pkg-test
file: ./Dockerfile.new
file: ./Dockerfile
cache-from: type=registry,ref=ghcr.io/r-odaf/r-odaf_health_canada:cache
cache-to: type=inline
- name: Disk space after build
Expand Down
105 changes: 33 additions & 72 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,93 +2,54 @@
## Build R-ODAF container for transcriptomic analysis ##
########################################################
# Mamba base image
FROM condaforge/mambaforge:23.3.1-1 as base
#continuumio/miniconda3 - difficult to install mamba, so switched away from this base
# snakemake image is based on mambaorg/micromamba
# mambaorg/micromamba in turn is based on debian:bookworm-slim
FROM snakemake/snakemake:stable
# v
# v8.4.8


# Required to avoid interactive prompts
ARG DEBIAN_FRONTEND=noninteractive
#ARG DEBIAN_FRONTEND=noninteractive
ARG PLATFORM=temposeq
ARG BUILD_CORES=8

# Set up a user for running; -m creates home directory, -s sets default shell
RUN useradd -ms /bin/bash R-ODAF

# Install dependencies for running pipeline
RUN apt-get update && apt-get -y install \
build-essential \
wget \
curl \
git \
libcairo2-dev \
libxt-dev \
tree \
gosu \
vim && \
mamba install -y -c conda-forge -c bioconda -n base snakemake && \
rm -rf /var/lib/apt/lists/* && \
gosu nobody true && \
df -h && \
apt-get clean && \
df -h
# verify that gosu works
# free up disk space on runner
# Install runtime dependencies that are necessary for your application
# Why /var/lib/dpkg/lock-frontend doesn't exist... I have no idea
RUN mkdir -p /var/lib/dpkg && touch /var/lib/dpkg/lock-frontend \
&&apt-get update \
&& apt-get install --no-install-recommends gosu \
&& gosu nobody true \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& df -h

RUN mkdir -p /home/R-ODAF/R-ODAF_Health_Canada
WORKDIR "/home/R-ODAF/R-ODAF_Health_Canada"
COPY . .
RUN chown -R R-ODAF:R-ODAF /home/R-ODAF
RUN mv inputs inputs.bak \
&& wget https://github.com/EHSRB-BSRSE-Bioinformatics/test-data/archive/master.tar.gz \
&& tar -zxvf master.tar.gz \
&& mv -f test-data-main/dev/${PLATFORM}/* ./ \
&& wget https://github.com/EHSRB-BSRSE-Bioinformatics/unify_temposeq_manifests/raw/main/output_manifests/Human_S1500_1.2_standardized.csv \
&& rm master.tar.gz

RUN chown -R R-ODAF:R-ODAF /home/R-ODAF && df -h
USER R-ODAF
RUN mv inputs inputs.bak

RUN git clone https://github.com/EHSRB-BSRSE-Bioinformatics/test-data \
&& mv test-data/${PLATFORM}/* ./ \
&& wget https://github.com/EHSRB-BSRSE-Bioinformatics/unify_temposeq_manifests/raw/main/output_manifests/Human_S1500_1.2_standardized.csv \
&& df -h

# Build environments with Snakemake
RUN /bin/bash -c "snakemake --cores ${BUILD_CORES} --use-conda --conda-create-envs-only && conda clean -y -a && df -h"
RUN snakemake --cores ${BUILD_CORES} --software-deployment-method conda --conda-create-envs-only

# Install extra dependency for reports
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 ##
########################################################
# R-ODAF base image
# Run tests using base dependencies, but updated code
# Note that if you alter any dependencies, the base container must be rebuilt
FROM base as tests

# Run tests
RUN /bin/bash -c "df -h && snakemake --cores 8 --use-conda"
RUN mamba run -p $(grep -rl "R-ODAF_reports" .snakemake/conda/*.yaml | sed s/\.yaml//) Rscript install.R

# Clean up files
FROM tests as cleanup
RUN snakemake --cores ${BUILD_CORES} --software-deployment-method conda \
&& df -h \
&& mkdir ./tests \
&& mv output test-data-main truth_checksums wikipathways-20210810-gmt-Homo_sapiens.gmt Human_S1500_1.2_standardized.csv inputs ./tests/ \
&& mv inputs.bak inputs \
&& rm -rf ./tests

# Clean up directories
RUN df -h &&\
mkdir ./tests && \
mv output \
test-data \
truth_checksums \
wikipathways-20210810-gmt-Homo_sapiens.gmt \
Human_S1500_1.2_standardized.csv \
inputs \
./tests/
RUN /bin/bash -c "tree inputs.bak && \
mv inputs.bak inputs"
# Move test files
USER root
RUN rm -r ./tests

########################################################
## Build R-ODAF container for transcriptomic analysis ##
########################################################
# From tested container with updated code
FROM cleanup
# Set the entrypoint for the container
ENTRYPOINT ["/home/R-ODAF/R-ODAF_Health_Canada/entrypoint.sh"]
55 changes: 0 additions & 55 deletions Dockerfile.new

This file was deleted.

0 comments on commit 86dd7ef

Please sign in to comment.