Module: Deploy::Commands

Includes:
Utility
Included in:
Runner
Defined in:
lib/deploy/commands.rb

Instance Method Summary collapse

Methods included from Utility

#command?

Instance Method Details

#build_image(repo, tag) ⇒ Object



7
8
9
10
11
# File 'lib/deploy/commands.rb', line 7

def build_image(repo, tag)
  shout "Building Docker Image: #{repo}:#{tag}"
  command = "docker build -t #{repo}:#{tag} ."
  exit(1) unless system(command)
end

#pull_image(repo, tag) ⇒ Object



25
26
27
28
29
# File 'lib/deploy/commands.rb', line 25

def pull_image(repo, tag)
  shout "Pulling Docker Image: #{repo}:#{tag}"
  command = "docker pull #{repo}:#{tag}"
  exit(1) unless system(command)
end

#push_image(repo, tag) ⇒ Object



19
20
21
22
23
# File 'lib/deploy/commands.rb', line 19

def push_image(repo, tag)
  shout "Pushing Docker Image: #{repo}:#{tag}"
  command = "docker push #{repo}:#{tag}"
  exit(1) unless system(command)
end

#run_deploy(version, environment) ⇒ Object



31
32
33
34
35
# File 'lib/deploy/commands.rb', line 31

def run_deploy(version, environment)
  command = "eb deploy #{environment} --label #{version}"
  shout "deploying #{version} to elastic beanstalk with command: #{command}"
  exit(1) unless system(command)
end

#run_rollback(version, environment) ⇒ Object



37
38
39
40
41
# File 'lib/deploy/commands.rb', line 37

def run_rollback(version, environment)
  command = "eb deploy #{environment} --version #{version}"
  shout "deploying #{version} to elastic beanstalk with command: #{command}"
  exit(1) unless system(command)
end

#tag_image_as_latest(repo, tag) ⇒ Object



13
14
15
16
17
# File 'lib/deploy/commands.rb', line 13

def tag_image_as_latest(repo, tag)
  shout "Tagging #{tag} Docker Image as Latest"
  command = "docker tag -f #{repo}:#{tag} #{repo}:latest"
  exit(1) unless system(command)
end