Skip to content

Instantly share code, notes, and snippets.

@zeryx
Last active October 10, 2019 21:14
Show Gist options
  • Save zeryx/68d8ef8945bfd5462132a24f535c46fe to your computer and use it in GitHub Desktop.
Save zeryx/68d8ef8945bfd5462132a24f535c46fe to your computer and use it in GitHub Desktop.
FROM SOMEIMAGENAME as runner_intermediate
# We want to cache the following permanently, as these won't change frequently and take a very long time to move around and rebuild.
COPY --from=builder0 --chown=2222:2222 /some/artifact_dir /some/artifact_dir
RUN find /some/artifact_dir > /tmp/artifact_files_BEFORE
FROM SOMEOTHERIMAGE as builder
#This operation occurs on every build operation, therefore to increase perf we want all ops after this to be fast.
RUN /usr/local/bin/comple_script
FROM runner_intermediate as runner_final
RUN find /some/artifact_dir > /tmp/artifact_files_AFTER
COPY --from=runner0 --chown=2222:2222 /tmp/artifact_files_BEFORE /tmp/artifact_files_BEFORE
RUN echo "comm -13 <(sort /tmp/artifact_files_BEFORE) <(sort /tmp/artifact_files_AFTER)\n" > /tmp/script_test && \
chmod +x /tmp/script_test
# This is a script that we're going to run in bash, which means we'll need to migrate to a script and call it with bash
RUN bash /tmp/script_test > /tmp/artifact_files_DIFF
# Now we have a file called artifact_DIFF which contains all the new files created by the compile operation
# TODO: Figure out how to copy each file/directory in that artifact_files_DIFF in a way that ensures that things are as fast as possible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment