class Fastlane::Actions::DockerClient

Public Instance Methods

build(repository, path, tag: "latest") click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_client.rb, line 4
def build(repository, path, tag: "latest")
  result = Actions.sh "docker build --pull -t #{repository.shellescape}:#{tag.shellescape} #{path.shellescape}"

  # Image ID is the last word of the last line
  return result.lines.last.split(" ").last
end
login(username, password, email: nil) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_client.rb, line 11
def login(username, password, email: nil)
  require 'open3'
  require 'shellwords'

  cmd = %W[docker login --username #{username} --password-stdin]
  cmd << "--email=\"#{email}\"" unless email.nil?

  Open3.capture2("cat - | " + cmd.shelljoin, stdin_data: password)
end
push(repository, tag: nil) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_client.rb, line 21
def push(repository, tag: nil)
  cmd = "docker push #{repository}"
  cmd << ":#{tag}" unless tag.nil?

  Actions.sh cmd
end