Documentation
¶
Overview ¶
Package heredoc provides utilities for formatting heredoc RUN instructions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatWithMounts ¶
func FormatWithMounts(commands []string, mounts []*instructions.Mount, variant shell.Variant, pipefail bool) string
FormatWithMounts formats commands as a heredoc RUN instruction. If mounts are provided, they are included in the RUN instruction.
We always prepend "set -e" to preserve the fail-fast semantics of && chains. Without it, heredocs only fail if the LAST command fails - intermediate failures are silently ignored. This is different from && chains where any failure stops execution.
When pipefail is true, "set -o pipefail" is also prepended to ensure that piped commands fail properly. This is the heredoc equivalent of SHELL ["/bin/bash", "-o", "pipefail", "-c"] and avoids needing a separate SHELL instruction when DL4006 is enabled alongside prefer-run-heredoc.
See: https://github.com/moby/buildkit/issues/2722 See: https://github.com/moby/buildkit/issues/4195
Types ¶
This section is empty.