Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
Created August 6, 2023 16:24
Show Gist options
  • Save mojaveazure/78b658ce67eae0a81fe8791942cebf68 to your computer and use it in GitHub Desktop.
Save mojaveazure/78b658ce67eae0a81fe8791942cebf68 to your computer and use it in GitHub Desktop.
Example Dockerfile showcasing S4 method caching at build-time
FROM rocker/r-ver:4.2.2
RUN apt-get update && apt-get upgrade -y
RUN Rscript -e "\
install.packages('remotes'); \
remotes::install_version('Matrix', '1.5.1'); \
install.packages('SeuratObject', repos = 'https://cloud.r-project.org')"
RUN Rscript -e "print(packageVersion('Matrix'))"
RUN Rscript -e "install.packages('Matrix')"
RUN Rscript -e "\
suppressPackageStartupMessages(library(SeuratObject)); \
data('pbmc_small'); \
graph <- pbmc_small[['RNA_snn']]; \
print(class(graph)); \
print(getClass('Graph')); \
cat('\n'); \
print('Attempting to show a Graph'); \
tryCatch(show(graph), error = function(e) {print(e$message); NULL}); \
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment