class Dockerhelper::Docker

Attributes

chdir[R]

Public Class Methods

new(chdir: Dir.pwd) click to toggle source
# File lib/dockerhelper/docker.rb, line 5
def initialize(chdir: Dir.pwd)
  @chdir = chdir
end

Public Instance Methods

build(dockerfile, tag: nil) click to toggle source
# File lib/dockerhelper/docker.rb, line 13
def build(dockerfile, tag: nil)
  tag || (raise 'Tag option is required')
  Command.new("docker build -t #{tag} -f #{dockerfile} .", label: 'docker-build', chdir: chdir).run
end
push(repo, tag: 'latest') click to toggle source
# File lib/dockerhelper/docker.rb, line 18
def push(repo, tag: 'latest')
  Command.new("docker push #{repo}:#{tag}", label: 'docker-build').run
end
tag(image, tag) click to toggle source
# File lib/dockerhelper/docker.rb, line 9
def tag(image, tag)
  Command.new("docker tag -f #{image} #{tag}", label: 'docker-tag').run
end