From 798fa5b2234d40a173e4d98722b16211b862df71 Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Sat, 15 Apr 2023 10:11:13 +0200 Subject: [PATCH] Add #133 --- DESCRIPTION | 1 + R/memo_misc.R | 29 +++++++++++++++++++++++++++++ data/recipes.rda | Bin 0 -> 428 bytes inst/update.R | 2 +- man/recipes.Rd | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 data/recipes.rda create mode 100644 man/recipes.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 0b1f90f..bfe534c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,3 +35,4 @@ Imports: Depends: R (>= 3.5.0) VignetteBuilder: knitr +LazyData: true diff --git a/R/memo_misc.R b/R/memo_misc.R index 9f72a03..852a670 100644 --- a/R/memo_misc.R +++ b/R/memo_misc.R @@ -61,6 +61,35 @@ NULL invisible() } +## data generation +## --- +## recipes <- list() +## recipes["texlive"] <- "## install texlive\nRUN apt-get install -y pandoc pandoc-citeproc texlive" +## recipes["texlivefull"] <- "## install texlive-full\nRUN apt-get install -y pandoc pandoc-citeproc texlive-full" +## recipes["quarto"] <- "## install quarto (latest)\nRUN apt-get install -y curl git && curl -LO https://quarto.org/download/latest/quarto-linux-amd64.deb && dpkg -i quarto-linux-amd64.deb && quarto install tool tinytex && rm quarto-linux-amd64.deb" +## recipes["clean"] <- "## Clean up caches\nRUN rm -rf /var/lib/apt/lists/* && if [ -d \"$CACHE_PATH\" ]; then rm -rf $CACHE_PATH; fi" +## recipes["make"] <- "## install GNU make\nRUN apt-get -y install make" +## usethis::use_data(recipes, overwrite = TRUE) + +#' Recipes for Building Container Images +#' +#' A list containing several useful recipes for container building. Useful for the `post_installation_steps` argument of [dockerize()]. Available recipes are: +#' * `texlive`: install pandoc and LaTeX, useful for rendering RMarkdown +#' * `texlivefull`: Similar to the above, but install the full distribution of TeX Live (~ 3GB) +#' * `quarto`: install quarto and tinytex +#' * `clean`: clean up the container image by removing cache +#' * `make`: install GNU make +#' @examples +#' \donttest{ +#' if (interactive()) { +#' graph <- resolve(pkgs = c("openNLP", "LDAvis", "topicmodels", "quanteda"), +#' snapshot_date = "2020-01-16") +#' ## install texlive +#' dockerize(graph, ".", post_installation_steps = recipes[['texlive']]) +#' } +#' } +"recipes" + ## internal data generation ## --- ## ### Supported OS Versions diff --git a/data/recipes.rda b/data/recipes.rda new file mode 100644 index 0000000000000000000000000000000000000000..af2554670009db3c6ee6e003d9cd08eb678d5fab GIT binary patch literal 428 zcmV;d0aN}$T4*^jL0KkKS;xqf5dZ+Pe}ezGNB~`Pl^8C?)=Izs|KI=t00A%ocC%>1 zD5DXRY7I02kN^Mx&}0UKL?@{pQ_^ZZOaU390{{RJVWJ5nhNh>QnvYY;G%_^x00Yzj zG6AQQC^&;)Z3ZY7rsvDI^$0V&zzkZ5h@5d5AV;Y>2hSw`W+G zLIH7v)hY?L76C4l1GuKu&JVqB;~`C8;#VxuhoJB{hyyiP35CQ;5MU$3F$OqvA+d=> zNQFWo%)JXD3Rf=qXlVvp?@Oe5wgSPTIn2?Hj)kF64@b-l%$_|<;d4kGBGx{DG9(f@ zKNEZk0f|Xk*+pRtq>w6lT$ literal 0 HcmV?d00001 diff --git a/inst/update.R b/inst/update.R index 6bfbdd1..e21c2cf 100644 --- a/inst/update.R +++ b/inst/update.R @@ -13,6 +13,6 @@ rang <- resolve(here::here(), ## You might want to edit `post_installation_steps` or `cache` dockerize(rang, output_dir = here::here(), verbose = TRUE, cache = TRUE, - post_installation_steps = c("RUN apt-get install make"), + post_installation_steps = c(recipes[['make']], recipes[['texlive']], recipes[['clean']]), insert_readme = FALSE, copy_all = TRUE) diff --git a/man/recipes.Rd b/man/recipes.Rd new file mode 100644 index 0000000..068b879 --- /dev/null +++ b/man/recipes.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/memo_misc.R +\docType{data} +\name{recipes} +\alias{recipes} +\title{Recipes for Building Container Images} +\format{ +An object of class \code{list} of length 5. +} +\usage{ +recipes +} +\description{ +A list containing several useful recipes for container building. Useful for the \code{post_installation_steps} argument of \code{\link[=dockerize]{dockerize()}}. Available recipes are: +\itemize{ +\item \code{texlive}: install pandoc and LaTeX, useful for rendering RMarkdown +\item \code{texlivefull}: Similar to the above, but install the full distribution of TeX Live (~ 3GB) +\item \code{quarto}: install quarto and tinytex +\item \code{clean}: clean up the container image by removing cache +\item \code{make}: install GNU make +} +} +\examples{ +\donttest{ +if (interactive()) { + graph <- resolve(pkgs = c("openNLP", "LDAvis", "topicmodels", "quanteda"), + snapshot_date = "2020-01-16") + ## install texlive + dockerize(graph, ".", post_installation_steps = recipes[['texlive']]) +} +} +} +\keyword{datasets}