Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@
# .libPaths() already includes site library for default R version.
.libPaths(c(.libPaths(), .Library.site))


# The remotes package is installed to install httpgd from GitHub
# The gdiff package is installed to support visual difference testing

# Configure r-universe for binary package installations dynamically
linux_binary_repo <- function(universe){
runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/',
system2('lsb_release', '-sc', stdout = TRUE),
R.version$arch,
substr(getRversion(), 1, 3))
sprintf('https://%s.%s', universe, runiverse)
}

# Set repos for CRAN and nx10 (httpgd) to use r-universe linux binaries
options(repos = c(
cran = linux_binary_repo("cran"),
nx10 = linux_binary_repo("nx10")
))

# VSCode httpgd graphics device integration (optional)
if (interactive() && Sys.getenv("TERM_PROGRAM") == "vscode") {
if (requireNamespace("httpgd", quietly=TRUE)) {
options(vsc.plot = FALSE)
options(device = function(...) {
httpgd::hgd(silent = TRUE)
.vsc.browser(httpgd::hgd_url(history = FALSE), viewer = "Beside")
})
}
}
# For PNG graphics uncomment following lines
# options(vsc.use_httpgd = FALSE,
# vsc.dev.args = list(width = 800, height = 600))
19 changes: 15 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \
software-properties-common \
subversion \
libmagick++-dev \
libpoppler-cpp-dev \
libfontconfig1-dev \
libfreetype6-dev \
libpng-dev \
libjpeg-dev \
libtiff-dev \
libharfbuzz-dev \
libfribidi-dev \
libcairo2-dev \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
&& wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \
&& apt-get update \
Expand All @@ -19,13 +28,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \
# Install R packages, with dynamic r-universe URL
RUN Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \
system2('lsb_release', '-sc', stdout = TRUE), \
R.version\$arch, \
R.version$arch, \
substr(getRversion(), 1, 3)); \
print('Installing packages...'); \
install.packages(c('languageserver', 'httpgd'), \
print('Installing packages from r-universe...'); \
install.packages(c('languageserver', 'gdiff', 'remotes'), \
repos = c(runiverse = paste0('https://cran.', runiverse), \
nx10 = paste0('https://nx10.', runiverse))); \
print('Packages installed.')"
print('Installing httpgd from GitHub...'); \
remotes::install_github('nx10/httpgd'); \
print('All packages installed.')"

# Define env var used in GitHub Actions that build and deploy container
ARG CONTAINER_VERSION
Expand Down