The RUN instruction will execute any commands in a new layer on top of the current image and commit the results.
With the –mount option 1), you don't need to copy executing script and dependencies into the image layers.
Example:
RUN --mount=target=/build /build/setup.sh
where:
the package are sorted in alphabetical order
RUN apt-get update && apt-get install -y \
package-bar \
package-baz \
package-foo
Pipe: set -o pipefail will fail the pipeline if one stage fails
RUN set -o pipefail && wget -O - https://some.site | wc -l > /number