Created
August 20, 2020 19:57
-
-
Save docwhat/84ab1e49d5b54e143b78e7bd5ae32227 to your computer and use it in GitHub Desktop.
Example of mounting one stage from another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1-experimental | |
FROM alpine:3 AS fetcher | |
# We don't care about minimizing the number layers for this image. | |
RUN apk add --no-cache curl ca-certificates | |
WORKDIR /files | |
RUN curl -sSLf -o chronic https://github.com/docwhat/chronic/releases/download/v1.0.11/chronic_linux_amd64 | |
FROM alpine:3 AS release | |
# We care about minimizing layers here. | |
# Documented here | |
# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md | |
RUN --mount=type=bind,from=fetcher,source=/files,target=/fetcher \ | |
cp /fetcher/chronic /bin/chronic && \ | |
chown 0:0 /bin/chronic && \ | |
chmod a+x /bin/chronic && \ | |
ln -nsf chronic /bin/cronic | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment