Create a dockerignore
template for {packrat}
-related files
Source: R/dockerignore-templates.R
dk_template_ignore_packrat.Rd
Creates a dockerignore
template with patterns to ignore {packrat}
library and
source directories.
Details
This template adds patterns to ignore {packrat}
library and source directories,
which are typically not needed in a Docker image. These include:
packrat/lib*/
: Package librariespackrat/src/
: Package sources
When using {packrat}
in a Dockerfile, you typically want to copy just the
{packrat}
configuration files and use {packrat}
's restore functionality to
rebuild the library inside the container, rather than copying the entire
library.
See also
dk_template_ignore_renv()
for renv-specific patterns,
dk_template_ignore_r()
for R-specific patterns, &
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_python()
,
dk_template_ignore_r()
,
dk_template_ignore_raw_data()
,
dk_template_ignore_renv()
Examples
# Create a new dockerignore with packrat patterns
di <- dk_template_ignore_packrat()
# Add packrat patterns to an existing dockerignore
di <- dockerignore() |>
di_add("*.log") |>
dk_template_ignore_packrat()