Class: Dash::Dockerfile::Rules::ContextSize

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

Overview

Measured only: how many megabytes this build actually shipped to the builder before it ran a single instruction.

Constant Summary collapse

THRESHOLD_BYTES =
50_000_000
SUGGESTION =
"trim the build context with .dockerignore, or point builder: context: at a smaller directory"

Instance Method Summary collapse

Instance Method Details

#findings ⇒ Object



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

def findings
  bytes = build&.context_bytes
  return [] if bytes.to_i <= THRESHOLD_BYTES

  [ warning("build context", "the build shipped #{Dash::Utils.human_bytes(bytes)}#{elapsed} of build context to the builder", SUGGESTION) ]
end