Module: Kdep::Docker

Defined in:
lib/kdep/docker.rb

Defined Under Namespace

Classes: Error

Class Method Summary collapse

Class Method Details

.build(tag:, context_dir:, dockerfile: nil, target: nil, platform: nil, build_args: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kdep/docker.rb', line 7

def self.build(tag:, context_dir:, dockerfile: nil, target: nil, platform: nil, build_args: nil)
  (tag)

  args = ["docker", "build", "--progress=plain", "-t", tag]
  args.push("--file", dockerfile) if dockerfile
  args.push("--target", target) if target
  args.push("--platform", platform) if platform
  if build_args.is_a?(Hash)
    build_args.each { |k, v| args.push("--build-arg", "#{k}=#{v}") }
  end
  args.push(context_dir)

  run_streaming(*args)
end

.push(tag) ⇒ Object



22
23
24
25
# File 'lib/kdep/docker.rb', line 22

def self.push(tag)
  (tag)
  run_streaming("docker", "push", tag)
end