diff --git a/omicron-karma/.dockerignore b/omicron-karma/.dockerignore new file mode 100644 index 0000000..f1f0ca7 --- /dev/null +++ b/omicron-karma/.dockerignore @@ -0,0 +1,24 @@ +# Ignore common files that shouldn't be included in Docker build context +.git +.gitignore +README.md +LICENSE +Makefile +docker-compose.yml +*.md + +# Ignore temporary files +*.tmp +*.temp +*~ +.DS_Store +Thumbs.db + +# Ignore logs +*.log + +# Ignore IDE files +.vscode/ +.idea/ +*.swp +*.swo \ No newline at end of file diff --git a/omicron-karma/Dockerfile b/omicron-karma/Dockerfile index 2c351d2..2439198 100644 --- a/omicron-karma/Dockerfile +++ b/omicron-karma/Dockerfile @@ -7,31 +7,34 @@ # R 4.5.0, Rock 2.1.1 FROM datashield/rock-base:6.3.3 -ENV DSMEDIATION_VERSION=0.0.3 -ENV DSEXPOSOME_VERSION=2.0.9 -ENV DSTIDYVERSE_VERSION=v1.0.4 -ENV DSOMICS_VERSION=v1.0.18-2 -ENV DSMTL_VERSION=0.9.9 -ENV DSSURVIVAL_VERSION=v2.1.3 -ENV DSBASE_VERSION=6.3.3 +# Set environment variables +ENV DSMEDIATION_VERSION=0.0.3 \ + DSEXPOSOME_VERSION=2.0.9 \ + DSTIDYVERSE_VERSION=v1.0.4 \ + DSOMICS_VERSION=v1.0.18-2 \ + DSMTL_VERSION=0.9.9 \ + DSSURVIVAL_VERSION=v2.1.3 \ + DSBASE_VERSION=6.3.3 \ + ROCK_LIB=/var/lib/rock/R/library -ENV ROCK_LIB=/var/lib/rock/R/library - -# Install new R packages -# dsMediation -RUN Rscript -e "remotes::install_github('datashield/dsMediation', ref = '$DSMEDIATION_VERSION', repos = c('https://cloud.r-project.org', 'https://cran.datashield.org'), upgrade = FALSE, lib = '$ROCK_LIB')" -# dsMTLBase -RUN Rscript -e "remotes::install_github('transbioZI/dsMTLBase', ref = '$DSMTL_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" -# dsSurvival -RUN Rscript -e "remotes::install_github('datashield/dsSurvival', ref = '$DSSURVIVAL_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" -# dsTidyverse -RUN Rscript -e "remotes::install_github('molgenis/ds-tidyverse', ref = '$DSTIDYVERSE_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" -# dsExposome -RUN Rscript -e "BiocManager::install(c('bumphunter', 'missMethyl', 'rexposome'), update = FALSE, ask = FALSE, lib = '$ROCK_LIB')" \ - && Rscript -e "remotes::install_github('isglobal-brge/dsExposome', ref = '$DSEXPOSOME_VERSION', repos = c('https://cloud.r-project.org', 'https://cran.datashield.org'), upgrade = FALSE, lib = '$ROCK_LIB')" -# dsOmics -RUN Rscript -e "BiocManager::install(c('Biobase', 'SNPRelate', 'GENESIS', 'GWASTools', 'GenomicRanges', 'SummarizedExperiment', 'DESeq2', 'edgeR', 'MEAL'), update = FALSE, ask = FALSE, lib = '$ROCK_LIB')" \ - && Rscript -e "remotes::install_github('isglobal-brge/dsOmics', ref = '$DSOMICS_VERSION', upgrade = FALSE, lib = '$ROCK_LIB')" -# dsBase -RUN Rscript -e "remotes::install_github('datashield/dsBase', ref = '$DSBASE_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" && \ - chown -R rock $ROCK_LIB +# Install new R packages in a single layer to reduce image size +RUN Rscript -e "install.packages('BiocManager', repos = 'https://cloud.r-project.org')" && \ + # Install BiocManager packages first + Rscript -e "BiocManager::install(c('bumphunter', 'missMethyl', 'rexposome', 'Biobase', 'SNPRelate', 'GENESIS', 'GWASTools', 'GenomicRanges', 'SummarizedExperiment', 'DESeq2', 'edgeR', 'MEAL'), update = FALSE, ask = FALSE, lib = '$ROCK_LIB')" && \ + # Install GitHub packages + Rscript -e "remotes::install_github('datashield/dsMediation', ref = '$DSMEDIATION_VERSION', repos = c('https://cloud.r-project.org', 'https://cran.datashield.org'), upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('transbioZI/dsMTLBase', ref = '$DSMTL_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('datashield/dsSurvival', ref = '$DSSURVIVAL_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('molgenis/ds-tidyverse', ref = '$DSTIDYVERSE_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('isglobal-brge/dsExposome', ref = '$DSEXPOSOME_VERSION', repos = c('https://cloud.r-project.org', 'https://cran.datashield.org'), upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('isglobal-brge/dsOmics', ref = '$DSOMICS_VERSION', upgrade = FALSE, lib = '$ROCK_LIB')" && \ + Rscript -e "remotes::install_github('datashield/dsBase', ref = '$DSBASE_VERSION', dependencies = TRUE, upgrade = FALSE, lib = '$ROCK_LIB')" && \ + # Clean up temporary files and caches to reduce image size + rm -rf /tmp/* && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /root/.cache/R && \ + Rscript -e "if (file.exists('/tmp/downloaded_packages')) unlink('/tmp/downloaded_packages', recursive = TRUE)" && \ + # Remove examples directories from installed R packages to reduce image size + find $ROCK_LIB -type d -name "examples" -exec rm -rf {} + 2>/dev/null || true && \ + # Set proper ownership + chown -R rock $ROCK_LIB