Add a line to a dockerfile
at a specific position
Source: R/dockerfile-modifications.R
dfm_add_line.Rd
Adds a raw line to a `dockerfile“ at a specified position. This is a lower-level function typically used internally by higher-level functions.
Details
Unlike the instruction-specific functions (dfi_*
), this function adds
raw text without any formatting or validation. It's useful for adding
comments or custom instructions not covered by the built-in functions.
See also
dfm_remove_line()
for removing a line &
dfm_replace_line()
for replacing a line
Other dockerfile modification functions:
dfm_group_similar()
,
dfm_move_line()
,
dfm_remove_line()
,
dfm_replace_line()
,
dfm_sort_by_instruction()
Examples
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0")
# Add a comment after the FROM instruction
df <- dfm_add_line(df, "# This is a comment", after = 1)