heredoc

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL