From 83f5cb86538c6aa3c128bec919422b21d4a30e8f Mon Sep 17 00:00:00 2001 From: George Stagg Date: Tue, 7 May 2024 14:11:18 +0100 Subject: [PATCH] Ensure pak is installed to system library Includes workaround for r-wasm/webr#422. --- build-rwasm/Dockerfile | 4 ++++ build-rwasm/code.R | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build-rwasm/Dockerfile b/build-rwasm/Dockerfile index ab6c7be..8821436 100644 --- a/build-rwasm/Dockerfile +++ b/build-rwasm/Dockerfile @@ -6,6 +6,10 @@ FROM $WEBR_IMAGE # Copies your code file from your action repository to the filesystem path `/` of the container COPY code.R /code.R +# TODO: Remove this workaround for r-wasm/webr#422 when no longer needed +RUN find /root/R/x86_64-pc-linux-gnu-library -maxdepth 2 -wholename '*/pak' -exec rm -rf {} \; +RUN /opt/R/current/bin/R -q -e 'install.packages("pak", lib = .Library)' + # Code file to execute when the docker container starts up (`entrypoint.sh`) ENTRYPOINT [ "Rscript" ] # ENTRYPOINT [ "/bin/bash", "-l", "-c" ] diff --git a/build-rwasm/code.R b/build-rwasm/code.R index 510b70f..2f5520f 100644 --- a/build-rwasm/code.R +++ b/build-rwasm/code.R @@ -31,7 +31,6 @@ if (is.character(strip) && length(strip) == 1 && strip == "NULL") strip <- NULL cat("\nArgs:\n") str(list(image_path = image_path, repo_path = repo_path, packages = packages, strip = strip)) -if (!require("pak", character.only = TRUE, quietly = TRUE)) install.packages("pak") if (!require("withr", character.only = TRUE, quietly = TRUE)) install.packages("withr") # Work in the GHA directory so that package reference 'local::.' works as expected