Class: Dash::Dockerfile::Rules::CacheExportCost

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

Overview

Measured only: mode=max exports every intermediate layer to the cache. On a persistent builder that is often pure overhead — but only the numbers from this build can say so.

Constant Summary collapse

SHARE =
0.2
SUGGESTION =
"try mode=min under builder: cache: options:"

Instance Method Summary collapse

Instance Method Details

#findings ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/dash/dockerfile/rules/cache_export_cost.rb', line 7

def findings
  return [] unless build && mode_max?

  exported, total = build.cache_export_seconds, build.total_step_seconds
  return [] if total.zero? || exported <= total * SHARE

  [ note("builder.cache", format("exporting the build cache took %.1fs of %.1fs with mode=max", exported, total), SUGGESTION) ]
end