Skip to contents

Adds one or more patterns to a dockerignore object, avoiding duplicates.

Usage

di_add(dockerignore, pattern)

Arguments

dockerignore

A dockerignore object

pattern

Character vector of patterns to add

Value

An updated dockerignore object with the new patterns added

Details

Patterns follow the same syntax as .gitignore files:

  • Lines starting with # are comments

  • Blank lines are ignored

  • Trailing slashes / specify directories

  • Patterns with special characters like *, ?, and [] use glob syntax

  • Lines starting with ! negate a pattern (include a file that would otherwise be ignored)

See also

di_remove() for removing patterns & di_replace() for replacing patterns

Other dockerignore instruction functions: di_remove(), di_replace()

Examples

di <- dockerignore()

# Add a single pattern
di <- di_add(di, ".git/")

# Add multiple patterns
di <- di_add(di, c("*.log", "node_modules/", "*.tmp"))