buncker 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c771a48ad5d8e26e4e39f719f2794fb1217eb395
4
+ data.tar.gz: aa6f0de4b943b434373b3b923f9e6077220402fe
5
+ SHA512:
6
+ metadata.gz: 08dc4ca482374699e3f10142ac6074a5efa14046ed25b2bafaef6a0ae1c989604145b91d6462280dd6c8a84b3daf1d80eb3fdd9339f4de344e62469850c241dd
7
+ data.tar.gz: 3ec0efc7fef9d8271697bc3d071c56fbcd30627b99cc4c5ed0e5228f92d906ffa91694d3f9fde0b1e19a511df8181a1944a88fe6b8f2fd25c8aa68051fbbc999
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice, this
5
+ list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation and/or
8
+ other materials provided with the distribution.
9
+ * Neither the name of Conjur Inc. nor the names of its contributors may be used
10
+ to endorse or promote products derived from this software without specific prior
11
+ written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Makefile ADDED
@@ -0,0 +1,23 @@
1
+ .PHONY: all build base app copyright
2
+
3
+ all: build base app
4
+
5
+ build: base
6
+ docker build -t conjurinc/buncker:build build
7
+
8
+ base:
9
+ docker build -t conjurinc/buncker:base base
10
+
11
+ app: base
12
+ docker build -t conjurinc/buncker app
13
+
14
+ copyright:
15
+ copyright-header \
16
+ --license BSD-3-CLAUSE \
17
+ --copyright-software Buncker \
18
+ --copyright-software-description "Builds minimal docker images from ruby-bundler bundles" \
19
+ --copyright-holder "Conjur Inc." \
20
+ --copyright-year 2014-2015 \
21
+ --guess-extension \
22
+ --add-path . \
23
+ --output-dir .
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Buncker
2
+
3
+ Builds docker images from ruby-bundler bundles.
4
+
5
+ ## Prerequisites
6
+
7
+ - docker
8
+
9
+ ## Installation
10
+
11
+ Needed only for development. Actual current images are available on the docker hub.
12
+ `make`
13
+
14
+ ## Usage
15
+
16
+ ```sh-session
17
+ $ cd my-app
18
+ $ ~/buncker/buncker.sh my-app
19
+ $ docker run -it --rm my-app "bundle exec rails s"
20
+ ```
21
+
22
+ ## Todo
23
+
24
+ - nicer invocation of resulting images
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/app/Dockerfile ADDED
@@ -0,0 +1,32 @@
1
+ #
2
+ # Copyright (c) 2014 Conjur Inc.
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation and/or
12
+ # other materials provided with the distribution.
13
+ # * Neither the name of Conjur Inc. nor the names of its contributors may be used
14
+ # to endorse or promote products derived from this software without specific prior
15
+ # written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ FROM conjurinc/buncker:base
29
+
30
+ WORKDIR /app
31
+ ENTRYPOINT ["/run.sh"]
32
+ ADD run.sh /
data/app/run.sh ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh --login
2
+
3
+ # This is just a wrapper to make sure the environment is properly configured.
4
+
5
+ exec "$@"
data/base/Dockerfile ADDED
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright (c) 2014 Conjur Inc.
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation and/or
12
+ # other materials provided with the distribution.
13
+ # * Neither the name of Conjur Inc. nor the names of its contributors may be used
14
+ # to endorse or promote products derived from this software without specific prior
15
+ # written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ FROM conjurinc/alpine
29
+
30
+ RUN apk update && apk add ruby-bundler libpq libgcc ruby-json
31
+ RUN echo "export PATH=$PATH:/usr/lib/ruby/gems/2.0.0/bin" > /etc/profile.d/rubygems.sh
data/bin/buncker ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'docker'
4
+ require 'fileutils'
5
+ require 'pathname'
6
+
7
+ name, tag = ARGV
8
+
9
+ cachedir = Pathname.pwd + '.buncker/cache'
10
+ cidfile = Pathname.pwd + '.buncker/cid'
11
+
12
+ FileUtils.mkdir_p cachedir
13
+ FileUtils.rm_f cidfile
14
+
15
+ slugpath = Pathname.pwd + '.buncker/slug'
16
+
17
+ archive = `git archive HEAD`;
18
+ builder = Docker::Container.create(
19
+ 'Image' => 'conjurinc/buncker:build',
20
+ 'Volumes' => {
21
+ '/app/vendor' => {}
22
+ },
23
+ 'OpenStdin' => true,
24
+ 'StdinOnce' => true,
25
+ )
26
+
27
+ builder.start 'Binds' => "#{cachedir}:/app/vendor"
28
+
29
+ slug = File.open slugpath, 'w'
30
+
31
+ builder.attach(
32
+ stdin: StringIO.new(archive),
33
+ stdout: true,
34
+ stderr: true,
35
+ logs: true,
36
+ ) do |stream, chunk|
37
+ case stream
38
+ when :stdout
39
+ slug.write chunk
40
+ else
41
+ print chunk
42
+ end
43
+ end;
44
+
45
+ builder.wait
46
+ builder.remove
47
+
48
+ slug.close
49
+
50
+ target = Docker::Container.create(
51
+ 'Image' => 'conjurinc/buncker',
52
+ 'OpenStdin' => true,
53
+ 'StdinOnce' => true,
54
+ 'Cmd' => %w(tar xC/)
55
+ )
56
+
57
+ target.start
58
+
59
+ target.attach(
60
+ stdin: File.open(slugpath),
61
+ stdout: true,
62
+ stderr: true,
63
+ logs: true,
64
+ ) do |stream, chunk|
65
+ print chunk
66
+ end
67
+
68
+ target.wait
69
+ target.commit repo: name, tag: tag
70
+ target.remove
data/build/Dockerfile ADDED
@@ -0,0 +1,34 @@
1
+ #
2
+ # Copyright (c) 2014 Conjur Inc.
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation and/or
12
+ # other materials provided with the distribution.
13
+ # * Neither the name of Conjur Inc. nor the names of its contributors may be used
14
+ # to endorse or promote products derived from this software without specific prior
15
+ # written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ FROM conjurinc/buncker:base
29
+
30
+ RUN apk update && apk add ruby-dev gcc make libc-dev git postgresql-dev libffi-dev
31
+
32
+ ADD ./build.sh /
33
+
34
+ CMD /build.sh
data/build/build.sh ADDED
@@ -0,0 +1,40 @@
1
+ #!/bin/sh -le
2
+ #
3
+ # Copyright (c) 2014 Conjur Inc.
4
+ # All rights reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without modification,
7
+ # are permitted provided that the following conditions are met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright notice, this
10
+ # list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation and/or
13
+ # other materials provided with the distribution.
14
+ # * Neither the name of Conjur Inc. nor the names of its contributors may be used
15
+ # to endorse or promote products derived from this software without specific prior
16
+ # written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ #
29
+
30
+ mkdir -p /app
31
+ tar xC /app
32
+ cd /app
33
+ bundle install --deployment --without development test cucumber appliance >&2
34
+ bundle clean >&2
35
+
36
+ cd /
37
+ tar c app
38
+
39
+ # some echo here is required, otherwise clients break connection prematurely
40
+ echo Slug built successfully. >&2
data/buncker.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'buncker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "buncker"
8
+ spec.version = Buncker::VERSION
9
+ spec.authors = ["Rafał Rzepecki"]
10
+ spec.email = ["rafal@conjur.net"]
11
+ spec.summary = %q{Builds docker images from ruby-bundler bundles}
12
+ spec.homepage = "https://github.com/conjurinc/buncker"
13
+ spec.license = "BSD-3-CLAUSE"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "docker-api", "~> 1.17"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
data/lib/buncker.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "buncker/version"
2
+
3
+ module Buncker
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Buncker
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: buncker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rafał Rzepecki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: docker-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - rafal@conjur.net
58
+ executables:
59
+ - buncker
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE
66
+ - Makefile
67
+ - README.md
68
+ - Rakefile
69
+ - app/Dockerfile
70
+ - app/run.sh
71
+ - base/Dockerfile
72
+ - bin/buncker
73
+ - build/Dockerfile
74
+ - build/build.sh
75
+ - buncker.gemspec
76
+ - lib/buncker.rb
77
+ - lib/buncker/version.rb
78
+ homepage: https://github.com/conjurinc/buncker
79
+ licenses:
80
+ - BSD-3-CLAUSE
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.4
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Builds docker images from ruby-bundler bundles
102
+ test_files: []