Skip to content

Commit a94efcd

Browse files
committed
allow binary installs for users
1 parent cb3b338 commit a94efcd

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ RUN curl -s https://raw.githubusercontent.com/boettiger-lab/repo2docker-r/refs/h
1010
COPY install.r install.r
1111
RUN Rscript install.r
1212

13+
## switch from BSPM to r-universe for user default, only after BSPM does install.r!
14+
COPY Rprofile /usr/lib/R/etc/Rprofile.site
1315
USER ${NB_USER}
16+
1417
COPY environment.yml environment.yml
1518
RUN conda env update -f environment.yml

Rprofile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Based on Jeroen's config:
2+
# https://github.com/r-universe-org/base-image/blob/f20ec9fc6f51ef8a89aad489206a43790bd9bf77/Rprofile
3+
4+
local({
5+
rver <- getRversion()
6+
distro <- system2('lsb_release', '-sc', stdout = TRUE)
7+
options(HTTPUserAgent = sprintf("R/%s R (%s)", rver, paste(rver, R.version$platform, R.version$arch, R.version$os)))
8+
options(repos = c(CRAN = sprintf("https://packagemanager.rstudio.com/all/__linux__/%s/latest", distro)))
9+
10+
# Enable BioConductor repos
11+
utils::setRepositories(ind = 1:4, addURLs = c(fallback = "https://cloud.r-project.org"))
12+
13+
# Enable universe repo(s)
14+
my_universe <- Sys.getenv("MY_UNIVERSE", "https://cran.r-universe.dev")
15+
if(nchar(my_universe)){
16+
my_repos <- trimws(strsplit(my_universe, ';')[[1]])
17+
binaries <- sprintf('%s/bin/linux/%s/%s', my_repos[1], distro, substr(rver, 1, 3))
18+
options(repos = c(binaries = binaries, universe = my_repos, getOption("repos")))
19+
}
20+
21+
# Other settings
22+
options(crayon.enabled = TRUE)
23+
Sys.unsetenv(c("CI", "GITHUB_ACTIONS"))
24+
25+
# Dummy token for API limits
26+
if(is.na(Sys.getenv("GITHUB_PAT", NA))){
27+
dummy <- c('ghp_SXg', 'LNM', 'Tu4cnal', 'tdqkZtBojc3s563G', 'iqv')
28+
Sys.setenv(GITHUB_PAT = paste(dummy, collapse = 'e'))
29+
}
30+
})
31+

0 commit comments

Comments
 (0)