Skip to content

Commit

Permalink
allow binary installs for users
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jan 14, 2025
1 parent cb3b338 commit a94efcd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ RUN curl -s https://raw.githubusercontent.com/boettiger-lab/repo2docker-r/refs/h
COPY install.r install.r
RUN Rscript install.r

## switch from BSPM to r-universe for user default, only after BSPM does install.r!
COPY Rprofile /usr/lib/R/etc/Rprofile.site
USER ${NB_USER}

COPY environment.yml environment.yml
RUN conda env update -f environment.yml
31 changes: 31 additions & 0 deletions Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Based on Jeroen's config:
# https://github.com/r-universe-org/base-image/blob/f20ec9fc6f51ef8a89aad489206a43790bd9bf77/Rprofile

local({
rver <- getRversion()
distro <- system2('lsb_release', '-sc', stdout = TRUE)
options(HTTPUserAgent = sprintf("R/%s R (%s)", rver, paste(rver, R.version$platform, R.version$arch, R.version$os)))
options(repos = c(CRAN = sprintf("https://packagemanager.rstudio.com/all/__linux__/%s/latest", distro)))

# Enable BioConductor repos
utils::setRepositories(ind = 1:4, addURLs = c(fallback = "https://cloud.r-project.org"))

# Enable universe repo(s)
my_universe <- Sys.getenv("MY_UNIVERSE", "https://cran.r-universe.dev")
if(nchar(my_universe)){
my_repos <- trimws(strsplit(my_universe, ';')[[1]])
binaries <- sprintf('%s/bin/linux/%s/%s', my_repos[1], distro, substr(rver, 1, 3))
options(repos = c(binaries = binaries, universe = my_repos, getOption("repos")))
}

# Other settings
options(crayon.enabled = TRUE)
Sys.unsetenv(c("CI", "GITHUB_ACTIONS"))

# Dummy token for API limits
if(is.na(Sys.getenv("GITHUB_PAT", NA))){
dummy <- c('ghp_SXg', 'LNM', 'Tu4cnal', 'tdqkZtBojc3s563G', 'iqv')
Sys.setenv(GITHUB_PAT = paste(dummy, collapse = 'e'))
}
})

0 comments on commit a94efcd

Please sign in to comment.