rumrunner 0.2.1 → 0.2.2
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 +62 -7
- data/lib/rumrunner/init.rb +19 -0
- data/lib/rumrunner/manifest.rb +3 -1
- data/lib/rumrunner/version.rb +1 -1
- data/lib/rumrunner.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f5c7dac4315813fa3843d94e075608585d4e6cdd9c1b52f6c447b8981ada492
|
4
|
+
data.tar.gz: 778ac8a9026a12e33edee3af59ea0e3d66b363d7eeee8ee88c4c777e98ffee86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef19b7605a22e532753f2c6eefa7fdeadd51584a6804dea22b57cedf36e38441e0125c34756e7445952d3bce5aff2764232aa0a13d305b148335fb2787424f96
|
7
|
+
data.tar.gz: a48ff0e320ea4b6c5a7521d734da3b4871ce0fb9822ae7fc6deb36a80e8c7b3c44863a1e76ee30d243c144f5d9c87431f0a5ef017bc74d0ea71f6a39bda1fffd
|
data/README.md
CHANGED
@@ -5,11 +5,9 @@
|
|
5
5
|
|
6
6
|
Rum Runner is a Rake-based utility for building multi-stage Dockerfiles.
|
7
7
|
|
8
|
-
Users can pair a multi-stage Dockerfile with a Rumfile that uses a
|
9
|
-
Rake-like DSL to customize each stage's build options and dependencies.
|
8
|
+
Users can pair a multi-stage Dockerfile with a Rumfile that uses a Rake-like DSL to customize each stage's build options and dependencies.
|
10
9
|
|
11
|
-
The `rum` executable allows users to easily invoke builds, shell-into
|
12
|
-
specific stages for debugging, and export artifacts from built containers.
|
10
|
+
The `rum` executable allows users to easily invoke builds, shell-into specific stages for debugging, and export artifacts from built containers.
|
13
11
|
|
14
12
|
Rum Runner has the following features:
|
15
13
|
* Rake-like DSL/CLI that enable simple annotation and execution of builds.
|
@@ -19,12 +17,34 @@ Rum Runner has the following features:
|
|
19
17
|
* Shell tasks are automatically provided for every stage
|
20
18
|
* Stage, artifact, and shell, steps can be customized
|
21
19
|
|
20
|
+
**Origins**
|
21
|
+
|
22
|
+
This project was born from using Makefiles to drive multi-stage builds. For the most part this worked really well, but it became a bit of an ordeal to write for more complex projects. This tool is an attempt to recreate that general technique with minimal annotation and limited assumptions.
|
23
|
+
|
22
24
|
## Installation
|
23
25
|
|
24
26
|
```bash
|
25
27
|
gem install rumrunner
|
26
28
|
```
|
27
29
|
|
30
|
+
## Quickstart
|
31
|
+
|
32
|
+
Use the helper `Rum.init` to create a template Rumfile for your project:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
# Install the gem
|
36
|
+
gem install rumrunner
|
37
|
+
|
38
|
+
# Navigate to the location of your Dockerfile
|
39
|
+
cd /path/to/your/Dockerfile/project/
|
40
|
+
|
41
|
+
# Create a basic Rumfile
|
42
|
+
ruby -r rumrunner -e Rum.init > Rumfile
|
43
|
+
|
44
|
+
# View available tasks
|
45
|
+
rum --tasks
|
46
|
+
```
|
47
|
+
|
28
48
|
## Example
|
29
49
|
|
30
50
|
Imagine a simple multi-stage Dockerfile:
|
@@ -46,9 +66,9 @@ Create `Rumfile` and describe your build:
|
|
46
66
|
rum :image_name do
|
47
67
|
tag "1.2.3"
|
48
68
|
|
49
|
-
stage :build
|
50
|
-
stage :test => :build
|
51
|
-
stage :deploy => :test
|
69
|
+
stage :build # => docker build --target build --tag image_name:1.2.3-build .
|
70
|
+
stage :test => :build # => docker build --target test --tag image_name:1.2.3-test .
|
71
|
+
stage :deploy => :test # => docker build --target deploy --tag image_name:1.2.3-deploy .
|
52
72
|
end
|
53
73
|
```
|
54
74
|
|
@@ -88,6 +108,41 @@ rum :image_name => "tmp" do |c|
|
|
88
108
|
end
|
89
109
|
```
|
90
110
|
|
111
|
+
## Build vs. Run
|
112
|
+
|
113
|
+
At the core, every directive within the `rum` block will eventually be interpreted as either a `docker build` or a `docker run` command. The type of directive is simply a way of specifying defaults for the command.
|
114
|
+
|
115
|
+
If you simply wish to define a named task that executes a build or a run, you can use the `build` or `run` directives:
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
rum :image_name do
|
119
|
+
build :fizz do
|
120
|
+
tag "image_name"
|
121
|
+
path "."
|
122
|
+
end # => docker build --tag image_name .
|
123
|
+
|
124
|
+
run :buzz do
|
125
|
+
rm true
|
126
|
+
image "image_name"
|
127
|
+
cmd %w{echo hello}
|
128
|
+
end # => docker run --rm image_name echo hello
|
129
|
+
end
|
130
|
+
```
|
131
|
+
|
132
|
+
## Shared ENV variables
|
133
|
+
|
134
|
+
The `env` method can be invoked in the `rum` block to declare a value that will be passed to all stages/artifacts/shells. For stages, the value will be passed using the `--build-arg` option; for artifacts and shells, the `--env` option.
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
rum :image_name do
|
138
|
+
env :FIZZ => :BUZZ
|
139
|
+
|
140
|
+
stage :build # => docker build --build-arg FIZZ=BUZZ ...
|
141
|
+
|
142
|
+
artifact "pkg.zip" => :build # => docker run --env FIZZ=BUZZ ...
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
91
146
|
## Customize Stages
|
92
147
|
|
93
148
|
Stages can be customized with blocks. Methods invoked on the stage are (with a few exceptions) passed onto the `docker build` command.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "rumrunner/docker"
|
2
|
+
|
3
|
+
module Rum
|
4
|
+
class << self
|
5
|
+
def init
|
6
|
+
# Get image name from stdin
|
7
|
+
$stderr.write "Docker image name: "
|
8
|
+
image = Docker::Image.parse(gets.chomp)
|
9
|
+
|
10
|
+
puts "#!/usr/bin/env ruby"
|
11
|
+
puts "rum :\"#{image.family}\" do"
|
12
|
+
File.read("Dockerfile").scan(/^FROM .*?$/).each_with_index do |line, i|
|
13
|
+
stage = line.scan(/ AS (.*?)$/).flatten.first || i.to_s
|
14
|
+
puts " stage :\"#{stage}\""
|
15
|
+
end if File.exists? "Dockerfile"
|
16
|
+
puts "end"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/rumrunner/manifest.rb
CHANGED
@@ -35,7 +35,7 @@ module Rum
|
|
35
35
|
def run(*args, &block)
|
36
36
|
name, _, deps = Rake.application.resolve_args(args)
|
37
37
|
task name => deps do
|
38
|
-
sh Docker::Run.new(&block).to_s
|
38
|
+
sh Docker::Run.new(image: @image, &block).to_s
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -145,6 +145,8 @@ module Rum
|
|
145
145
|
|
146
146
|
def install
|
147
147
|
install_clean
|
148
|
+
|
149
|
+
self
|
148
150
|
end
|
149
151
|
|
150
152
|
private
|
data/lib/rumrunner/version.rb
CHANGED
data/lib/rumrunner.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.2.
|
4
|
+
version: 0.2.2
|
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-07-
|
11
|
+
date: 2019-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/rumrunner/application.rb
|
139
139
|
- lib/rumrunner/docker.rb
|
140
140
|
- lib/rumrunner/dsl_definition.rb
|
141
|
+
- lib/rumrunner/init.rb
|
141
142
|
- lib/rumrunner/manifest.rb
|
142
143
|
- lib/rumrunner/version.rb
|
143
144
|
homepage: https://github.com/amancevice/rumrunner.git
|