In essence, this well known pattern (joining command invocations together over multiple lines with && \
)
FROM ubuntu:22.04
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl
may be replaced with this
FROM ubuntu:22.04
RUN <<EOF
set -e
apt-get update
apt-get upgrade -y
apt-get install -y curl
EOF
The heredoc syntax is enabled by default when building with BuildKit (standard for DockerDesktop as well as DockerEngine since v23.0). It doesn’t apply to older versions or when not building with BuildKit.
This feature is not supported in Kaniko.