Last active
February 20, 2020 06:09
-
-
Save Syerram/9a2ec3dc8c79feadf27ed95950f0ba80 to your computer and use it in GitHub Desktop.
multi-stage-dockerfile
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
| docker build --build-arg BASE_IMAGE_VERSION_1=1.31.1 \ | |
| --build-arg LABEL_1=1.11 \ | |
| --build-arg BASE_IMAGE_VERSION_2=3.8.5 \ | |
| --build-arg LABEL_2=2.22 \ | |
| --build-arg LABEL_3=3.33 | |
| -t ms-test:v3 . |
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
| ARG BASE_IMAGE_VERSION_1 | |
| ARG BASE_IMAGE_VERSION_2 | |
| FROM busybox:$BASE_IMAGE_VERSION_1 as builder | |
| ARG LABEL_1 | |
| COPY hello.txt hello.txt | |
| RUN echo "in builder" | |
| RUN echo $LABEL_1 | |
| LABEL org.opencontainers.image.revision=$LABEL_1 | |
| FROM alpine:$BASE_IMAGE_VERSION_2 | |
| ARG LABEL_2 | |
| ARG LABEL_3 | |
| COPY --from=builder hello.txt hello.txt | |
| RUN cat hello.txt | |
| RUN echo "in dev" | |
| RUN echo $LABEL_3 | |
| LABEL org.opencontainers.image.source=$LABEL_2 | |
| LABEL org.opencontainers.image.vendor=$LABEL_3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment