Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
Created April 17, 2024 02:29
Show Gist options
  • Save mojaveazure/2c455a6cafc3b4ea2d7731634093c89e to your computer and use it in GitHub Desktop.
Save mojaveazure/2c455a6cafc3b4ea2d7731634093c89e to your computer and use it in GitHub Desktop.
Dockerfile testing how double-pins work for R package installation and loading/attachment
FROM rocker/r-ver:latest
RUN apt-get update && \
apt-get install -y cmake git wget pandoc
# RUN Rscript -e "repos <- paste0('https://', c('mojaveazure', 'tiledb-inc'), '.r-universe.dev')" \
# -e "repos <- unlist(lapply(repos, \(x) paste0(x, c('/bin/linux/jammy/4.3/', ''))))" \
# -e "repos <- paste(shQuote(repos), collapse = ', ')" \
# -e "cat('options(repos = c(', repos, ', getOption(\"repos\")))\n', sep = '')" | \
# tee -a ~/.Rprofile
RUN echo "options(repos = c('https://mojaveazure.r-universe.dev', getOption('repos')))" | \
tee -a ~/.Rprofile
RUN Rscript -e "getOption('repos')"
RUN Rscript -e "db <- utils::available.packages(filters = c('R_version', 'OS_type'))" \
-e "db[db[, 'Package'] == 'tiledb', c('Version', 'Repository')]"
RUN Rscript -e "db <- utils::available.packages(filters = c('R_version', 'OS_type'))" \
-e "db[db[, 'Package'] == 'tiledbsoma', c('Version', 'Repository')]"
RUN Rscript -e "uri <- paste(contrib.url(getOption('repos')[1L], 'source'), 'tiledbsoma_1.8.1.tar.gz', sep = '/')" \
-e "dest <- tempfile()" \
-e "dir.create(dest, showWarnings = FALSE, recursive = TRUE)" \
-e "download.file(uri, destfile = file.path(dest, basename(uri)))" \
-e "untar(file.path(dest, basename(uri)), files = 'tiledbsoma/DESCRIPTION', exdir = dest)" \
-e "desc <- read.dcf(file.path(dest, 'tiledbsoma/DESCRIPTION'), fields = 'Imports')" \
-e "unlink(dest, recursive = TRUE, force = TRUE)" \
-e "print(desc)"
RUN Rscript -e "utils::install.packages('tiledbsoma')"
RUN Rscript -e "library(tiledbsoma)" \
-e "tiledbsoma::show_package_versions()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment