Skip to content

Instantly share code, notes, and snippets.

@DerekChia
Created December 26, 2021 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerekChia/63303e68126cd7747fb0baa2fbe235e4 to your computer and use it in GitHub Desktop.
Save DerekChia/63303e68126cd7747fb0baa2fbe235e4 to your computer and use it in GitHub Desktop.
# First stage
FROM debian as base
ENV VAR_ENV=env_value
ARG VAR_ARG=arg_value
ONBUILD ENV VAR_ENV_ONBUILD=onbuild_env_value
ONBUILD ARG VAR_ARG_ONBUILD=onbuild_arg_value
RUN echo "First stage build time:"; env | grep VAR_
# Second stage
FROM base
RUN echo "Second stage build time:"; env | grep VAR_
# Third stage
FROM base
RUN echo "Third stage build time:"; env | grep VAR_
CMD ["bash", "-c", "echo At runtime; env | grep VAR_"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment