bricky 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/etc/bricks/bundle/builder +6 -7
- data/etc/bricks/debian/builder +9 -9
- data/etc/bricks/helper/builder +6 -0
- data/etc/bricks/helper/suexec +7 -0
- data/etc/bricks/mounts/builder +5 -8
- data/etc/hacker/id_container/Dockerfile +3 -0
- data/etc/templates/bricky/bricky.yml +0 -1
- data/lib/bricky/bricks/base.rb +19 -0
- data/lib/bricky/bricks/bundle.rb +14 -3
- data/lib/bricky/bricks/debian.rb +1 -1
- data/lib/bricky/bricks/helper.rb +4 -10
- data/lib/bricky/bricks/mounts.rb +1 -1
- data/lib/bricky/bricks.rb +3 -3
- data/lib/bricky/commands/bootstrap.rb +33 -7
- data/lib/bricky/commands/builder.rb +7 -3
- data/lib/bricky/config.rb +6 -2
- data/lib/bricky/version.rb +1 -1
- metadata +7 -4
- data/etc/templates/bricky/images/runtime/Dockerfile +0 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjM2MWMyMDM5OWQ1NjgxNTE3ODI5M2MyNGI4NzE1MDIzMTU1YzRlYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Njk1MDA2M2ZjYzllZDVmNTdmZjZmMzJhMTY1MjhiMDhmZmY3YjM3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGFmNzIwMDYyNDAxNzY0Njk5MmY0MWU2ZmRmYTRmMTYzYTkwZDNkMzEyYjkz
|
10
|
+
YTNjODdkMTAyNmYzYWRiMzIwZDIzNTIwYzdhNWE1NGUwMGJlNDJmMjQ5YzE1
|
11
|
+
YzBjMGZiZGM3MmRiZTc5ZjE0MjFkMWFhNDVlYmQ1OTQ2OGJiZDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTYyN2E0NGUzN2QyNzA0ZDNiNDc4MzBhZTUzZDY2MmJkYzU1Y2U5YjBjODQz
|
14
|
+
MzVmOGU1ZTg5NzkyOTI3ODNmNDc0MjEwYzlmNGNlMjAxMGMxZGI4Y2Q3N2Nj
|
15
|
+
YzQxZmU2MjUzN2NhM2UxMDVlZDI3MWVkNTQ1MjJiY2E2YzY2NTU=
|
data/etc/bricks/bundle/builder
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
#!/bin/bash -
|
1
|
+
#!/bin/bash -le
|
2
2
|
|
3
|
-
|
4
|
-
message=$1;
|
5
|
-
echo -e "\n\n\033[32m${message}\033[0m";
|
6
|
-
}
|
3
|
+
. $BRICKS_HOME/suexec
|
7
4
|
|
8
5
|
execute() {
|
6
|
+
. $BRICKS_HOME/builder
|
7
|
+
|
9
8
|
info 'Vendor project with Bundler'
|
10
|
-
pushd /opt/
|
9
|
+
pushd /opt/workspace/source
|
11
10
|
gem install bundler --conservative --no-ri --no-rdoc
|
12
11
|
bundle install --deployment --without=development:test
|
13
12
|
popd
|
14
13
|
}
|
15
14
|
|
16
|
-
execute
|
15
|
+
suexec execute
|
data/etc/bricks/debian/builder
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
#!/bin/bash -
|
1
|
+
#!/bin/bash -e
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
echo -e "\n\n\033[32m${message}\033[0m";
|
6
|
-
}
|
3
|
+
. $BRICKS_HOME/suexec
|
4
|
+
chown -R builder. /builded
|
7
5
|
|
8
6
|
execute() {
|
7
|
+
. $BRICKS_HOME/builder
|
8
|
+
|
9
9
|
info 'Starting buildpackage'
|
10
|
-
pushd /opt/
|
10
|
+
pushd /opt/workspace/source
|
11
11
|
dpkg-buildpackage -b -rfakeroot
|
12
12
|
popd
|
13
13
|
|
14
14
|
info 'Moving deb files to volume'
|
15
|
-
rm -
|
16
|
-
mv /opt/
|
15
|
+
rm -Rf /builded/*
|
16
|
+
mv /opt/workspace/*.deb /builded/
|
17
17
|
|
18
18
|
info 'Recreating local debian packages index'
|
19
19
|
dpkg-scanpackages /builded/ | gzip > /builded/Packages.gz
|
20
20
|
}
|
21
21
|
|
22
|
-
execute
|
22
|
+
suexec execute
|
data/etc/bricks/mounts/builder
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
#!/bin/bash -
|
1
|
+
#!/bin/bash -le
|
2
2
|
|
3
|
-
|
4
|
-
message=$1;
|
5
|
-
echo -e "\n\n\033[32m${message}\033[0m";
|
6
|
-
}
|
3
|
+
. $BRICKS_HOME/builder
|
7
4
|
|
8
5
|
execute() {
|
9
|
-
info '
|
10
|
-
rsync -a --stats /bricks/mounts/volumes/ /opt/
|
6
|
+
info 'Building workspace'
|
7
|
+
rsync -a --stats /bricks/mounts/volumes/ /opt/workspace
|
8
|
+
chown -R builder. /opt/workspace
|
11
9
|
}
|
12
10
|
|
13
|
-
|
14
11
|
execute
|
data/lib/bricky/bricks/bundle.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
1
3
|
module Bricky
|
2
4
|
module Bricks
|
3
|
-
class Bundle <
|
5
|
+
class Bundle < Base
|
4
6
|
def arguments
|
5
7
|
scripts_path = "#{bricks_path}/bundle"
|
6
8
|
results = ["-v #{scripts_path}:/bricks/bundle"]
|
@@ -14,8 +16,17 @@ module Bricky
|
|
14
16
|
|
15
17
|
private
|
16
18
|
def cached
|
17
|
-
|
18
|
-
|
19
|
+
["-v #{local_path}:/opt/workspace/source/vendor/bundle"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def local_path
|
23
|
+
path = "/tmp/bricky/cache/#{digest}"
|
24
|
+
FileUtils::mkdir_p(path)
|
25
|
+
path
|
26
|
+
end
|
27
|
+
|
28
|
+
def digest
|
29
|
+
Digest::MD5.file('Gemfile').hexdigest
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
data/lib/bricky/bricks/debian.rb
CHANGED
data/lib/bricky/bricks/helper.rb
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
module Bricky
|
2
2
|
module Bricks
|
3
|
-
class Helper
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
self.config = config
|
3
|
+
class Helper < Base
|
4
|
+
def arguments
|
5
|
+
["-v #{bricks_path}/helper:/bricks/helper",
|
6
|
+
"-e BRICKS_HOME=/bricks/helper"]
|
8
7
|
end
|
9
|
-
|
10
|
-
private
|
11
|
-
def bricks_path
|
12
|
-
File.expand_path("../../../../etc/bricks", __FILE__)
|
13
|
-
end
|
14
8
|
end
|
15
9
|
end
|
16
10
|
end
|
data/lib/bricky/bricks/mounts.rb
CHANGED
data/lib/bricky/bricks.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require "
|
2
|
-
require "bricky/bricks/helper"
|
1
|
+
require "bricky/bricks/base"
|
3
2
|
|
3
|
+
require "bricky/bricks/helper"
|
4
4
|
require "bricky/bricks/ruby"
|
5
5
|
require "bricky/bricks/bundle"
|
6
6
|
require "bricky/bricks/debian"
|
@@ -13,7 +13,7 @@ module Bricky
|
|
13
13
|
def resolve
|
14
14
|
Bricky.config.bricks.collect do |name, config|
|
15
15
|
resolve_and_initialize(name, config)
|
16
|
-
|
16
|
+
end.uniq << Bricky::Bricks::Helper.new({})
|
17
17
|
end
|
18
18
|
|
19
19
|
def resolve_and_initialize(name, config)
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require "etc"
|
2
|
+
require "fileutils"
|
3
|
+
|
1
4
|
module Bricky
|
2
5
|
module Commands
|
3
6
|
module Bootstrap
|
@@ -10,12 +13,16 @@ module Bricky
|
|
10
13
|
|
11
14
|
private
|
12
15
|
def build(image)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
puts "
|
18
|
-
|
16
|
+
base = command(image.name, image.path)
|
17
|
+
hack = command(image.name, create_hack_image(image))
|
18
|
+
|
19
|
+
[base, hack].each do |code|
|
20
|
+
puts "Processing #{name} image: ".colorize(:blue) + code
|
21
|
+
|
22
|
+
unless system(code)
|
23
|
+
puts "~~~~~~~~~~~ Problems building image ~~~~~~~~~~~".colorize(:white).on_red
|
24
|
+
return false
|
25
|
+
end
|
19
26
|
end
|
20
27
|
|
21
28
|
true
|
@@ -26,7 +33,26 @@ module Bricky
|
|
26
33
|
end
|
27
34
|
|
28
35
|
def images
|
29
|
-
["builder"
|
36
|
+
["builder"].collect {|image| Bricky::Image.new(image) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_hack_image(image)
|
40
|
+
hack_path = FileUtils::mkdir_p("/tmp/bricky/containers/#{Bricky.config.name}").first
|
41
|
+
File.open("#{hack_path}/Dockerfile", "w") { |file| file.write(parse_hack_template(image)) }
|
42
|
+
hack_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_hack_template(image)
|
46
|
+
template = "#{Bricky.config.hacker_path}/id_container/Dockerfile"
|
47
|
+
parser = ERB.new(open(template).read)
|
48
|
+
variables = OpenStruct.new({ "image" => image.name, uid: Etc.getpwuid.uid })
|
49
|
+
|
50
|
+
# :(
|
51
|
+
def variables.get_binding
|
52
|
+
binding
|
53
|
+
end
|
54
|
+
|
55
|
+
parser.result(variables.get_binding)
|
30
56
|
end
|
31
57
|
end
|
32
58
|
end
|
@@ -13,9 +13,9 @@ module Bricky
|
|
13
13
|
private
|
14
14
|
def build(image)
|
15
15
|
code = command(image)
|
16
|
-
puts
|
16
|
+
puts format(code)
|
17
17
|
|
18
|
-
unless system(code
|
18
|
+
unless system(code)
|
19
19
|
puts "~~~~~~~~~~~ Problems building image ~~~~~~~~~~~".colorize(:white).on_red
|
20
20
|
return false
|
21
21
|
end
|
@@ -26,10 +26,14 @@ module Bricky
|
|
26
26
|
def command(image)
|
27
27
|
bricks = Bricky::Bricks.resolve
|
28
28
|
arguments = bricks.collect(&:arguments).uniq.join(" ")
|
29
|
-
entrypoints = bricks.collect(&:entrypoint).uniq.join("
|
29
|
+
entrypoints = bricks.collect(&:entrypoint).compact.uniq.join(" && ")
|
30
30
|
|
31
31
|
"docker run #{arguments} -i -t #{image.name} /bin/bash -l -c '#{entrypoints}'"
|
32
32
|
end
|
33
|
+
|
34
|
+
def format(command)
|
35
|
+
command.split("-v ").join("\n\t -v ").split("-i ").join("\n\t -i ")
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
data/lib/bricky/config.rb
CHANGED
@@ -14,8 +14,12 @@ module Bricky
|
|
14
14
|
self.bricks = config["bricks"]
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
File.expand_path("#{base_path}/
|
17
|
+
def bricks_path
|
18
|
+
File.expand_path("#{base_path}/etc/bricks", __FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
def hacker_path
|
22
|
+
File.expand_path("#{base_path}/etc/hacker", __FILE__)
|
19
23
|
end
|
20
24
|
|
21
25
|
private
|
data/lib/bricky/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bricky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrerocker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,13 +91,16 @@ files:
|
|
91
91
|
- bin/bricky
|
92
92
|
- etc/bricks/bundle/builder
|
93
93
|
- etc/bricks/debian/builder
|
94
|
+
- etc/bricks/helper/builder
|
95
|
+
- etc/bricks/helper/suexec
|
94
96
|
- etc/bricks/mounts/builder
|
97
|
+
- etc/hacker/id_container/Dockerfile
|
95
98
|
- etc/templates/Brickyfile
|
96
99
|
- etc/templates/bricky/bricky.yml
|
97
100
|
- etc/templates/bricky/images/builder/Dockerfile
|
98
|
-
- etc/templates/bricky/images/runtime/Dockerfile
|
99
101
|
- lib/bricky.rb
|
100
102
|
- lib/bricky/bricks.rb
|
103
|
+
- lib/bricky/bricks/base.rb
|
101
104
|
- lib/bricky/bricks/bundle.rb
|
102
105
|
- lib/bricky/bricks/debian.rb
|
103
106
|
- lib/bricky/bricks/helper.rb
|
@@ -132,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
135
|
version: '0'
|
133
136
|
requirements: []
|
134
137
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.4.
|
138
|
+
rubygems_version: 2.4.3
|
136
139
|
signing_key:
|
137
140
|
specification_version: 4
|
138
141
|
summary: a new way to build and package applications
|