Create a dockerignore template for {renv}-related files
Source: R/dockerignore-templates.R
dk_template_ignore_renv.RdCreates a dockerignore template with patterns to ignore {renv} library and cache
directories.
Details
This template adds patterns to ignore {renv} library and cache directories,
which are typically not needed in a Docker image. These include:
renv/library/: Package libraryrenv/staging/: Staging area for packagesrenv/python/: Python librariesrenv/local/: Local cache
When using {renv} in a Dockerfile, you typically want to copy just the
renv.lock file and use renv::restore() to rebuild the library inside
the container, rather than copying the entire library.
See also
dk_template_ignore_r() for R-specific patterns,
dk_from_renv() for creating a Dockerfile from an renv.lock file, &
dk_template_ignore_common() for a more comprehensive template
Other dockerignore template functions:
dk_template_ignore_common(),
dk_template_ignore_data(),
dk_template_ignore_editor(),
dk_template_ignore_git(),
dk_template_ignore_node(),
dk_template_ignore_os(),
dk_template_ignore_packrat(),
dk_template_ignore_python(),
dk_template_ignore_r(),
dk_template_ignore_raw_data()
Examples
# Create a new dockerignore with renv patterns
di <- dk_template_ignore_renv()
di
#> renv/library/
#> renv/staging/
#> renv/python/
#> renv/local/
# Add renv patterns to an existing dockerignore
di <- dockerignore() |>
di_add("*.log") |>
dk_template_ignore_renv()
di
#> *.log
#> renv/library/
#> renv/staging/
#> renv/python/
#> renv/local/