Create a dockerignore template for editor-related files
Source:R/dockerignore-templates.R
dk_template_ignore_editor.Rd
Creates a dockerignore
template with patterns to ignore files and directories
created by common code editors and IDEs.
Details
This template adds patterns to ignore files and directories created by common code editors and IDEs, including:
VS Code:
.vscode/
,*.code-workspace
JetBrains IDEs (e.g., RStudio, PyCharm):
.idea/
,*.iml
,*.iws
Sublime Text:
*.sublime-workspace
,*.sublime-project
Vim:
*.swp
,*.swo
,*~
Emacs:
#*#
,.#*
,.projectile
Eclipse:
.classpath
,.project
,.settings/
Visual Studio:
.vs/
,*.suo
,*.njsproj
,*.sln
These files are typically not needed in a Docker image and can reduce the build context size.
See also
dk_template_ignore_os()
for OS-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_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()
,
dk_template_ignore_renv()
Examples
# Create a new dockerignore with editor patterns
di <- dk_template_ignore_editor()
di
#> .vscode/
#> *.code-workspace
#> .idea/
#> *.iml
#> *.iws
#> *.ipr
#> out/
#> *.sublime-workspace
#> *.sublime-project
#> *.swp
#> *.swo
#> *~
#> #*#
#> .#*
#> .projectile
#> .classpath
#> .project
#> .settings/
#> .vs/
#> *.suo
#> *.ntvs*
#> *.njsproj
#> *.sln
#> *.sw?
# Add editor patterns to an existing dockerignore
di <- dockerignore() |>
di_add("*.log") |>
dk_template_ignore_editor()
di
#> *.log
#> .vscode/
#> *.code-workspace
#> .idea/
#> *.iml
#> *.iws
#> *.ipr
#> out/
#> *.sublime-workspace
#> *.sublime-project
#> *.swp
#> *.swo
#> *~
#> #*#
#> .#*
#> .projectile
#> .classpath
#> .project
#> .settings/
#> .vs/
#> *.suo
#> *.ntvs*
#> *.njsproj
#> *.sln
#> *.sw?