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 0000000..af25546 Binary files /dev/null and b/data/recipes.rda differ 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}