From ad89963520c7e9a1386a3a371a09a2bd330d12df Mon Sep 17 00:00:00 2001 From: Jordi Rosell Date: Fri, 16 Feb 2024 14:18:16 +0100 Subject: [PATCH] remove renv from r2u and add new option pak --- .github/workflows/pak.yml | 18 ++++++++++++++++++ Dockerfile | 2 +- pak.Dockerfile | 13 +++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pak.yml create mode 100644 pak.Dockerfile diff --git a/.github/workflows/pak.yml b/.github/workflows/pak.yml new file mode 100644 index 0000000..956e58a --- /dev/null +++ b/.github/workflows/pak.yml @@ -0,0 +1,18 @@ +name: R packages from pak + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: docker build -f pak.Dockerfile -t my-pak-name . + - run: docker run --rm --name my_pak_container -v /github/workspace/output/:/workspace/output/:rw my-pak-name + - uses: actions/upload-artifact@v3 + with: + path: /github/workspace/output/ diff --git a/Dockerfile b/Dockerfile index 5e63f21..12d5726 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM rocker/r2u:22.04 WORKDIR /workspace -RUN R -e "install.packages(c('dplyr', 'purrr', 'curl', 'readr', 'stringr', 'ggplot2', 'janitor', 'targets', 'renv'))" +RUN R -e "install.packages(c('dplyr', 'purrr', 'curl', 'readr', 'stringr', 'ggplot2', 'janitor', 'targets'))" COPY _targets.R functions.R /workspace diff --git a/pak.Dockerfile b/pak.Dockerfile new file mode 100644 index 0000000..bab2d63 --- /dev/null +++ b/pak.Dockerfile @@ -0,0 +1,13 @@ +FROM rocker/r-ver:4.3 + +WORKDIR /workspace + +RUN R -e "install.packages('pak');pak::pak(c('dplyr', 'purrr', 'curl', 'readr', 'stringr', 'ggplot2', 'janitor', 'targets'))" + +COPY _targets.R functions.R /workspace + +CMD R -e "sessionInfo(); \ +list.files(); \ +# options(renv.config.dependencies.limit = Inf); \ +renv::snapshot(lockfile = 'output/renv.lock'); \ +targets::tar_make();" \ No newline at end of file