Create a dockerignore
template for R-related files
Source: R/dockerignore-templates.R
dk_template_ignore_r.Rd
Creates a dockerignore
template with patterns to ignore common R-related files
and directories.
Details
This template adds patterns to ignore common R-related files and directories that aren't needed in a Docker image, including:
.Rproj.user/
: RStudio user settings.Rhistory
: R command history.RData
: R workspace data.Ruserdata
: R user data*.Rproj
: RStudio project files*.rds
: R serialized data files.Rcheck/
: R package check directories
If renv = TRUE
, it also adds patterns to ignore {renv}
library
directories, which should be rebuilt inside the container.
If packrat = TRUE
, it adds patterns to ignore {packrat}
library
directories.
See also
dk_template_ignore_renv()
for renv-specific patterns,
dk_template_ignore_packrat()
for packrat-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_packrat()
,
dk_template_ignore_python()
,
dk_template_ignore_raw_data()
,
dk_template_ignore_renv()
Examples
# Create a new dockerignore with R patterns
di <- dk_template_ignore_r()
di
#> .Rproj.user/
#> .Rhistory
#> .RData
#> .Ruserdata
#> *.Rproj
#> *.rds
#> .lintr
#> *.Rcheck/
#> .Renviron
#> .Rprofile
#> renv/library/
#> renv/staging/
#> renv/python/
#> renv/local/
#> packrat/lib*/
#> packrat/src/
# Include R patterns but exclude package managers
di <- dk_template_ignore_r(renv = FALSE, packrat = FALSE)
di
#> .Rproj.user/
#> .Rhistory
#> .RData
#> .Ruserdata
#> *.Rproj
#> *.rds
#> .lintr
#> *.Rcheck/
#> .Renviron
#> .Rprofile