Class: Google

Inherits:
Object
  • Object
show all
Defined in:
lib/docker/google.rb

Class Method Summary collapse

Class Method Details

.push_container(image_tag) ⇒ Object



17
18
19
20
# File 'lib/docker/google.rb', line 17

def self.push_container(image_tag)
    command = "gcloud preview docker push #{image_tag}"
    fail "Could not push container: #{image_tag}" unless system(command)
end

.tag_container(image_id, repo, project_id) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/docker/google.rb', line 3

def self.tag_container(image_id, repo, project_id)
    time = Time.new
    image_timestamp = "#{time.year}-#{time.month}-#{time.day}_#{time.hour}#{time.min}#{time.sec}"
    branch = `git rev-parse --abbrev-ref HEAD`.strip
    command = "docker tag #{image_id} #{repo}/#{project_id}:#{branch}-latest"
    puts command
    system command
    tag = "#{repo}/#{project_id}:#{branch}-#{image_timestamp}"
    command = "docker tag #{image_id} #{tag}"
    puts command
    system command
    return tag
end