ecs_helper 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ecs_helper/command/build_and_push.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f017450f082be10839e64a35642a8c44abb4e6540d7eef78734a63c220d6efdb
|
4
|
+
data.tar.gz: 57a607aced91c083ac213516105596cfb09b71777bc9a8fb46f4e900774e27ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|