ecs_helper 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9da09c69b8b7494c861ea3c278a10e86fbdcbf46a91d8b9253f997d899c33d7a
4
- data.tar.gz: 4a47644247bd3d6fe9d6a31f58ad3734ea9387f1f70698a4aa89d92d7c64fbee
3
+ metadata.gz: f017450f082be10839e64a35642a8c44abb4e6540d7eef78734a63c220d6efdb
4
+ data.tar.gz: 57a607aced91c083ac213516105596cfb09b71777bc9a8fb46f4e900774e27ac
5
5
  SHA512:
6
- metadata.gz: 8cab278533bc6ea72f9847e574beb37c731a9e913739e1956b42d50fe0b7fcfb40bef0f74d53f7430b764b0e85b2ab986922d81b8753863ca1f04e9859905838
7
- data.tar.gz: a1d216b96efaf72fd04e864d4ba795ed84eb2c429fc3f435098c1347f49e0992b16c6467e6ad6dc761dfb794e19a2208c454f9d8cd1213613a4081cae6c82891
6
+ metadata.gz: 29422f588f3a3742d8a686259b09c3d56a4e0732d2bdcf1e656fb7ccb1fd71b228be6924f2a0919c9b64145ecd7862e007753a5d4139dfa37e533db7f4f13c09
7
+ data.tar.gz: a39d0a39a26224e284b980f9c032a0f8c9ee029356ea4813848447abea1dc8f3bc6a8e80dcae4a4a798e51901144fa0f9c68dcccaa40d7596304286f9e3dd2b0
@@ -10,6 +10,7 @@ class ECSHelper::Command::BuildAndPush < ECSHelper::Command::Base
10
10
  opts.on("-d VALUE", "--directory VALUE", "Set directory for dockerfile and context, default = './'") { |c| options[:directory] = processEqual(c) }
11
11
  opts.on("-p VALUE", "--project VALUE", "Set project name, if not specified will look at ENV['PROJECT'], will be used to detect cluster") { |p| options[:project] = processEqual(p) }
12
12
  opts.on("-a VALUE", "--application VALUE", "Set application name, if not specified will look at ENV['APPLICATION'], will be used to detect service and task definition") { |a| options[:application] = processEqual(a) }
13
+ opts.on("-c", "--cache", "Cache image before build, default false") { options[:cache] = true }
13
14
  end
14
15
  [parser, options]
15
16
  end
@@ -24,7 +25,7 @@ class ECSHelper::Command::BuildAndPush < ECSHelper::Command::Base
24
25
  log("Repository", repository)
25
26
  log("Auth Private", auth_private)
26
27
  log("Auth Public", auth_public)
27
- log("Pull", pull)
28
+ should_cache? && log("Pull", pull)
28
29
  log("Build", build)
29
30
  log("Push", push)
30
31
  end
@@ -39,6 +40,10 @@ class ECSHelper::Command::BuildAndPush < ECSHelper::Command::Base
39
40
  auth_cmd.run
40
41
  end
41
42
 
43
+ def should_cache?
44
+ options[:cache]
45
+ end
46
+
42
47
  def pull
43
48
  pull_cmd = Terrapin::CommandLine.new("docker pull #{latest_tag}")
44
49
  pull_cmd.run
@@ -47,7 +52,11 @@ class ECSHelper::Command::BuildAndPush < ECSHelper::Command::Base
47
52
  end
48
53
 
49
54
  def build
50
- build_cmd = Terrapin::CommandLine.new("docker build #{directory} --cache-from #{latest_tag} --tag #{latest_tag} --tag #{version_tag}")
55
+ build_command = ["docker build #{directory}"]
56
+ cache_command = should_cache? ? ["--cache-from #{latest_tag}"] : []
57
+ tags_command = ["--tag #{latest_tag} --tag #{version_tag}"]
58
+ command = (build_command + cache_command + tags_command).join(' ')
59
+ build_cmd = Terrapin::CommandLine.new(command)
51
60
  puts "Building with two tags: #{latest_tag} & #{version_tag}"
52
61
  build_cmd.run
53
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Petrov