Class: Deploy::Deployer

Inherits:
Thor
  • Object
show all
Includes:
Output
Defined in:
lib/deploy/deployer.rb

Instance Method Summary collapse

Methods included from Output

#colorize, #green, #pink, #red, #shout, #yellow

Instance Method Details

#deployObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/deploy/deployer.rb', line 13

def deploy
  check_setup

  version = options[:version]
  repo = ENV['DOCKER_REPO']
  
  shout "Building Docker Image: #{repo}:#{version}"
  command = "docker build -t #{repo}:#{version} ."
  system(command)

  shout "Tagging #{version} Docker Image"
  command = "docker tag -f #{repo}:#{version} #{repo}:latest"
  system(command)

  shout "Pushing Docker Image: #{repo}:#{version}"
  command = "docker push #{repo}:#{version}"
  system(command)
  shout "Pushing Docker Image: #{repo}:latest"
  command = "docker push #{repo}:latest"
  system(command)

  command = "eb deploy --label #{version}"
  system(command)
end

#rollbackObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/deploy/deployer.rb', line 40

def rollback
  version = options[:version]
  repo = ENV['DOCKER_REPO']

  shout "Tagging #{version} Docker Image"
  command = "docker tag -f #{repo}:#{version} #{repo}:latest"
  system(command)

  shout "Pushing Docker Image: #{repo}:latest"
  command = "docker push #{repo}:latest"
  system(command)

  command = "eb deploy --version #{version}"
  system(command)
end

#setupObject



6
7
8
9
# File 'lib/deploy/deployer.rb', line 6

def setup
  command = "eb init"
  system(command)
end