rumrunner 0.3.2 → 0.3.4
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/README.md +13 -4
- data/lib/rumrunner/manifest.rb +16 -13
- data/lib/rumrunner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da4a1989a2252315eba1d4bcd4d921b25ee90c53fd77b2ce6e720dad5a07b807
|
4
|
+
data.tar.gz: ed649270e0622f1aabc134ce1529403dc534b040b6857c5a7fd0db4c4daedbd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61514ca3d73be5d90755d2a82af2abee79c38ce673ec310e77e96f7f18ea924a03f0bba8a8821745eb9ff3ce27a5f3dd03470a956e2554610670a5677fe2bb1f
|
7
|
+
data.tar.gz: 59c77172cef86582a1973b761a1e2b9d7475db4d1d477f7f721379777e5f0bb6a448eea8aba4ae673de281f961dad73de549a14bb0300d76c55977ce5ea27941
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
[](https://github.com/amancevice/rumrunner)
|
2
2
|
[](https://travis-ci.com/amancevice/rumrunner)
|
3
3
|
[](https://badge.fury.io/rb/rumrunner)
|
4
4
|
[](https://codeclimate.com/github/amancevice/rumrunner/test_coverage)
|
5
5
|
[](https://codeclimate.com/github/amancevice/rumrunner/maintainability)
|
6
6
|
|
7
|
+
<sub>logo by [seenamavaddat.com](http://seenamavaddat.com/)</sub>
|
7
8
|
|
8
9
|
Rum Runner is a Rake-based utility for building multi-stage Dockerfiles.
|
9
10
|
|
@@ -34,7 +35,7 @@ gem install rumrunner
|
|
34
35
|
|
35
36
|
## Quickstart
|
36
37
|
|
37
|
-
|
38
|
+
If you have a multi-stage Dockerfile in your project and are unsure where to begin, use the `rum init` helper to create a template Rumfile for your project:
|
38
39
|
|
39
40
|
```bash
|
40
41
|
gem install rumrunner
|
@@ -42,6 +43,8 @@ rum init > Rumfile
|
|
42
43
|
rum --tasks
|
43
44
|
```
|
44
45
|
|
46
|
+
The `init` command will parse a Dockerfile in the current directory and output a simple Rumfile with each stage and its dependencies declared.
|
47
|
+
|
45
48
|
## Example
|
46
49
|
|
47
50
|
Imagine a simple multi-stage Dockerfile:
|
@@ -158,7 +161,13 @@ end
|
|
158
161
|
|
159
162
|
The methods inside blocks for `build`, `run`, `stage`, `artifact`, and `shell` tasks are dynamically handled. Any option you might pass to the `docker run` or `docker build` command can be used.
|
160
163
|
|
161
|
-
Simply drop any leading `-`s from the option and convert to snake-case.
|
164
|
+
Simply drop any leading `-`s from the option and convert to snake-case.
|
165
|
+
|
166
|
+
Eg,
|
167
|
+
|
168
|
+
`--build-arg` becomes `build_arg`
|
169
|
+
|
170
|
+
`--env-file` becomes `env_file`.
|
162
171
|
|
163
172
|
## Shared ENV variables
|
164
173
|
|
@@ -173,7 +182,7 @@ rum :image_name do
|
|
173
182
|
artifact "pkg.zip" => :build
|
174
183
|
|
175
184
|
# rum build => docker build --build-arg FIZZ=BUZZ ...
|
176
|
-
# rum pkg.zip => docker run
|
185
|
+
# rum pkg.zip => docker run --env FIZZ=BUZZ ...
|
177
186
|
end
|
178
187
|
```
|
179
188
|
|
data/lib/rumrunner/manifest.rb
CHANGED
@@ -89,8 +89,8 @@ module Rum
|
|
89
89
|
name, _, deps = Rake.application.resolve_args(args)
|
90
90
|
|
91
91
|
# Assemble image/iidfile from manifest/stage name
|
92
|
-
image = "#{@image}-#{name}"
|
93
|
-
iidfile = File.join(root, image)
|
92
|
+
image = Docker::Image.parse("#{@image}-#{name}")
|
93
|
+
iidfile = File.join(root, *image)
|
94
94
|
iidpath = File.split(iidfile).first
|
95
95
|
|
96
96
|
# Ensure path to iidfile exists
|
@@ -98,7 +98,8 @@ module Rum
|
|
98
98
|
directory iidpath
|
99
99
|
iidpath
|
100
100
|
else
|
101
|
-
deps.map{|x|
|
101
|
+
images = deps.map{|x| Docker::Image.parse("#{@image}-#{x}") }
|
102
|
+
images.map{|x| File.join(root, *x) }
|
102
103
|
end
|
103
104
|
|
104
105
|
# Build stage and save digest in iidfile
|
@@ -126,8 +127,8 @@ module Rum
|
|
126
127
|
name, _, deps = Rake.application.resolve_args(args)
|
127
128
|
|
128
129
|
target = deps.first
|
129
|
-
image = "#{@image}-#{target}"
|
130
|
-
iidfile = File.join(root, image)
|
130
|
+
image = Docker::Image.parse("#{@image}-#{target}")
|
131
|
+
iidfile = File.join(root, *image)
|
131
132
|
path = File.split(name).first
|
132
133
|
deps = [iidfile]
|
133
134
|
|
@@ -151,8 +152,8 @@ module Rum
|
|
151
152
|
def shell(*args, &block)
|
152
153
|
target = Rake.application.resolve_args(args).first
|
153
154
|
name = task_name shell: target
|
154
|
-
image = "#{@image}-#{target}"
|
155
|
-
iidfile = File.join(root, image)
|
155
|
+
image = Docker::Image.parse("#{@image}-#{target}")
|
156
|
+
iidfile = File.join(root, *image)
|
156
157
|
|
157
158
|
Rake::Task[name].clear if Rake::Task.task_defined?(name)
|
158
159
|
|
@@ -196,9 +197,9 @@ module Rum
|
|
196
197
|
task :clean do
|
197
198
|
Dir[File.join root, "**/*"].reverse.each do |name|
|
198
199
|
sh "docker", "image", "rm", "--force", File.read(name) if File.file?(name)
|
199
|
-
|
200
|
+
rm_rf name
|
200
201
|
end
|
201
|
-
|
202
|
+
rm_rf root
|
202
203
|
end
|
203
204
|
end
|
204
205
|
|
@@ -206,9 +207,11 @@ module Rum
|
|
206
207
|
# Install file task for stage and save digest in iidfile
|
207
208
|
def stage_file(iidfile, iiddeps, tag:, target:, &block)
|
208
209
|
file iidfile => iiddeps do
|
210
|
+
tsfile = "#{iidfile}@#{Time.now.utc.to_i}"
|
209
211
|
build = Docker::Build.new(options: build_options, &block)
|
210
|
-
build.with_defaults(iidfile:
|
212
|
+
build.with_defaults(iidfile: tsfile, tag: tag, target: target)
|
211
213
|
sh build.to_s
|
214
|
+
cp tsfile, iidfile
|
212
215
|
end
|
213
216
|
end
|
214
217
|
|
@@ -244,7 +247,7 @@ module Rum
|
|
244
247
|
task task_name(clean: name) do
|
245
248
|
if File.exist? iidfile
|
246
249
|
sh "docker", "image", "rm", "--force", File.read(iidfile)
|
247
|
-
|
250
|
+
rm_rf iidfile
|
248
251
|
end
|
249
252
|
end
|
250
253
|
|
@@ -272,8 +275,8 @@ module Rum
|
|
272
275
|
def artifact_clobber(name, path)
|
273
276
|
desc "Remove any generated files"
|
274
277
|
task :clobber => :clean do
|
275
|
-
|
276
|
-
|
278
|
+
rm_rf name
|
279
|
+
rm_rf path unless path == "."
|
277
280
|
end
|
278
281
|
end
|
279
282
|
|
data/lib/rumrunner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumrunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Mancevice
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|