Class: Dash::Dockerfile::Rules::CacheBustingArg

Inherits:
Base
  • Object
show all
Defined in:
lib/dash/dockerfile/rules/cache_busting_arg.rb

Overview

An ARG that changes on every commit — a git SHA, a build timestamp — invalidates every layer from its first use onwards. Referenced after the dependency install it costs nothing; referenced before it, it costs the whole install.

Constant Summary collapse

CACHE_BUSTING =
/\A(?:.*_)?(?:GIT_SHA|COMMIT|SHA|BUILD_DATE|BUILD_TIME|BUILDTIME|VERSION)\z/i
TOOLCHAIN =

RUBY_VERSION, NODE_VERSION and friends name a toolchain and change once a quarter.

/_VERSION\z/i
SUGGESTION =
"reference it after the dependency install, so a new commit does not invalidate it"

Instance Method Summary collapse

Instance Method Details

#findings ⇒ Object



10
11
12
# File 'lib/dash/dockerfile/rules/cache_busting_arg.rb', line 10

def findings
  document.each_instruction("ARG").filter_map { |arg| finding_for(arg) }
end