dry-dock 0.1.0

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.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +6 -0
  3. data/.pryrc +1 -0
  4. data/.rspec +2 -0
  5. data/Dockerfile +69 -0
  6. data/Gemfile +20 -0
  7. data/Gemfile.lock +102 -0
  8. data/LICENSE +22 -0
  9. data/README.md +75 -0
  10. data/Rakefile +53 -0
  11. data/VERSION +1 -0
  12. data/bin/drydock +45 -0
  13. data/bin/json-test-consumer.rb +11 -0
  14. data/bin/json-test-producer.rb +25 -0
  15. data/bin/test-tar-writer-digest.rb +27 -0
  16. data/dry-dock.gemspec +135 -0
  17. data/examples/ruby-dsl.rb +14 -0
  18. data/examples/ruby-node-app-dsl.rb +128 -0
  19. data/examples/test-dsl.rb +9 -0
  20. data/examples/test.rb +46 -0
  21. data/lib/drydock/cli_flags.rb +46 -0
  22. data/lib/drydock/container_config.rb +75 -0
  23. data/lib/drydock/docker_api_patch.rb +176 -0
  24. data/lib/drydock/drydock.rb +65 -0
  25. data/lib/drydock/errors.rb +6 -0
  26. data/lib/drydock/file_manager.rb +26 -0
  27. data/lib/drydock/formatters.rb +13 -0
  28. data/lib/drydock/ignorefile_definition.rb +61 -0
  29. data/lib/drydock/image_repository.rb +50 -0
  30. data/lib/drydock/logger.rb +61 -0
  31. data/lib/drydock/object_caches/base.rb +24 -0
  32. data/lib/drydock/object_caches/filesystem_cache.rb +88 -0
  33. data/lib/drydock/object_caches/in_memory_cache.rb +52 -0
  34. data/lib/drydock/object_caches/no_cache.rb +38 -0
  35. data/lib/drydock/phase.rb +50 -0
  36. data/lib/drydock/phase_chain.rb +233 -0
  37. data/lib/drydock/plugins/apk.rb +31 -0
  38. data/lib/drydock/plugins/base.rb +15 -0
  39. data/lib/drydock/plugins/npm.rb +16 -0
  40. data/lib/drydock/plugins/package_manager.rb +30 -0
  41. data/lib/drydock/plugins/rubygems.rb +30 -0
  42. data/lib/drydock/project.rb +427 -0
  43. data/lib/drydock/runtime_options.rb +79 -0
  44. data/lib/drydock/stream_monitor.rb +54 -0
  45. data/lib/drydock/tar_writer.rb +36 -0
  46. data/lib/drydock.rb +35 -0
  47. data/spec/assets/MANIFEST +4 -0
  48. data/spec/assets/hello-world.txt +1 -0
  49. data/spec/assets/sample.tar +0 -0
  50. data/spec/assets/test.sh +3 -0
  51. data/spec/drydock/cli_flags_spec.rb +38 -0
  52. data/spec/drydock/container_config_spec.rb +230 -0
  53. data/spec/drydock/docker_api_patch_spec.rb +103 -0
  54. data/spec/drydock/drydock_spec.rb +25 -0
  55. data/spec/drydock/file_manager_spec.rb +53 -0
  56. data/spec/drydock/formatters_spec.rb +26 -0
  57. data/spec/drydock/ignorefile_definition_spec.rb +123 -0
  58. data/spec/drydock/image_repository_spec.rb +54 -0
  59. data/spec/drydock/object_caches/base_spec.rb +28 -0
  60. data/spec/drydock/object_caches/filesystem_cache_spec.rb +48 -0
  61. data/spec/drydock/object_caches/no_cache_spec.rb +62 -0
  62. data/spec/drydock/phase_chain_spec.rb +118 -0
  63. data/spec/drydock/phase_spec.rb +67 -0
  64. data/spec/drydock/plugins/apk_spec.rb +49 -0
  65. data/spec/drydock/plugins/base_spec.rb +13 -0
  66. data/spec/drydock/plugins/npm_spec.rb +26 -0
  67. data/spec/drydock/plugins/package_manager_spec.rb +12 -0
  68. data/spec/drydock/plugins/rubygems_spec.rb +53 -0
  69. data/spec/drydock/project_import_spec.rb +39 -0
  70. data/spec/drydock/project_spec.rb +156 -0
  71. data/spec/drydock/runtime_options_spec.rb +31 -0
  72. data/spec/drydock/stream_monitor_spec.rb +41 -0
  73. data/spec/drydock/tar_writer_spec.rb +27 -0
  74. data/spec/spec_helper.rb +47 -0
  75. data/spec/support/shared_examples/base_class.rb +3 -0
  76. data/spec/support/shared_examples/container_config.rb +12 -0
  77. data/spec/support/shared_examples/drydockfile.rb +6 -0
  78. metadata +223 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ae72734cb29ba338e59b30a6e20eab3b97d3871
4
+ data.tar.gz: d7b6a777e09a3118f47aad70cc5a28c52e484d73
5
+ SHA512:
6
+ metadata.gz: 418c2516346a52be4c91f4d7b0ffcd666d2be264d52e9d536088ad4bb4ce71d4335dc577a982f0592624ef7730fc95674ba8fbd2301cdf18fd7729f25e084762
7
+ data.tar.gz: 6369d9384d4e0d9d65a49029f4b385191d41a3a7547c3c68b2f673a01c978df75e1167b6837623d9bbdef0a42572a3500c28b66bd515c2bf751ca1ff8793c9e5
data/.dockerignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle
2
+ .dockerignore
3
+ .git
4
+ Dockerfile
5
+ pkg
6
+ vendor
data/.pryrc ADDED
@@ -0,0 +1 @@
1
+ require_relative 'lib/drydock'
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Dockerfile ADDED
@@ -0,0 +1,69 @@
1
+ # Dockerfile
2
+ # image: ripta/drydock:v1.0
3
+ # repo: https://github.com/ripta/drydock.git
4
+
5
+ FROM gliderlabs/alpine:3.2
6
+ MAINTAINER Ripta Pasay <ripta+docker@pasay.name>
7
+
8
+ LABEL meta.version="1.0" meta.onbuild=true
9
+
10
+ RUN apk update
11
+
12
+ # Install the base and dev packages
13
+ RUN apk add ruby ruby-dev \
14
+ && apk add nodejs nodejs-dev
15
+
16
+ # Install the headers and build packages
17
+ RUN apk add musl musl-dev \
18
+ && apk add linux-headers \
19
+ && apk add gcc g++ \
20
+ && apk add make \
21
+ && apk add curl curl-dev \
22
+ && apk add openssh
23
+
24
+ RUN apk add libffi-dev libxml2-dev libxslt-dev
25
+
26
+ RUN apk add git
27
+
28
+ RUN curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.3/gosu-amd64 \
29
+ && chmod +x /bin/gosu
30
+
31
+ # This is needed due to the missing trust certificates in alpine linux
32
+ RUN gem source --add https://s3.amazonaws.com/production.s3.rubygems.org/ \
33
+ && gem source --remove https://rubygems.org/
34
+
35
+ # Update to the latest rubygems and install bundler
36
+ RUN gem update --system --no-document \
37
+ && gem install --no-document bundler \
38
+ && gem install --no-document unicorn
39
+
40
+ # Throw build errors if Gemfile has been modified without updating Gemfile.lock
41
+ RUN bundle config --global frozen 1 \
42
+ && bundle config --global build.nokogiri --use-system-libraries
43
+
44
+ # Install bower and gulp
45
+ RUN npm install -g bower gulp
46
+
47
+ # Prepare global environment variables
48
+ ENV APPLICATION_ROOT /app/
49
+ RUN mkdir ${APPLICATION_ROOT}
50
+ WORKDIR ${APPLICATION_ROOT}
51
+
52
+ # Build rubygem dependencies
53
+ ONBUILD COPY Gemfile ${APPLICATION_ROOT}
54
+ ONBUILD COPY Gemfile.lock ${APPLICATION_ROOT}
55
+ ONBUILD RUN bundle --path vendor
56
+
57
+ # Build npm dependencies
58
+ ONBUILD COPY package.json ${APPLICATION_ROOT}/package.json
59
+ ONBUILD RUN cd ${APPLICATION_ROOT} && npm install
60
+
61
+ # Copy the application source in
62
+ ONBUILD COPY . ${APPLICATION_ROOT}
63
+
64
+ # Clean up build tools
65
+ ONBUILD RUN apk del libffi-dev libxml2-dev libxslt-dev curl-dev \
66
+ && apk del gcc g++ make musl-dev \
67
+ && apk del nodejs-dev ruby-dev
68
+ ONBUILD RUN rm -rf /var/cache/apk/*
69
+
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+
2
+ source 'https://rubygems.org'
3
+
4
+ group :development do
5
+ gem 'rake', '~> 10.0'
6
+ gem 'jeweler', '~> 2.0'
7
+ gem 'pry', '~> 0.10'
8
+
9
+ gem 'simplecov', '~> 0.9'
10
+ gem 'simplecov-rcov', '~> 0.2'
11
+ end
12
+
13
+ group :test do
14
+ gem 'rspec', '~> 3.0'
15
+ gem 'rspec-collection_matchers'
16
+ gem 'fakefs', require: false
17
+ end
18
+
19
+ gem 'docker-api', '~> 1.22', require: 'docker'
20
+ gem 'excon', '~> 0.45'
data/Gemfile.lock ADDED
@@ -0,0 +1,102 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.3.8)
5
+ builder (3.2.2)
6
+ coderay (1.1.0)
7
+ descendants_tracker (0.0.4)
8
+ thread_safe (~> 0.3, >= 0.3.1)
9
+ diff-lcs (1.2.5)
10
+ docile (1.1.5)
11
+ docker-api (1.22.4)
12
+ excon (>= 0.38.0)
13
+ json
14
+ excon (0.45.4)
15
+ fakefs (0.6.7)
16
+ faraday (0.9.1)
17
+ multipart-post (>= 1.2, < 3)
18
+ git (1.2.9.1)
19
+ github_api (0.12.4)
20
+ addressable (~> 2.3)
21
+ descendants_tracker (~> 0.0.4)
22
+ faraday (~> 0.8, < 0.10)
23
+ hashie (>= 3.4)
24
+ multi_json (>= 1.7.5, < 2.0)
25
+ nokogiri (~> 1.6.6)
26
+ oauth2
27
+ hashie (3.4.2)
28
+ highline (1.7.3)
29
+ jeweler (2.0.1)
30
+ builder
31
+ bundler (>= 1.0)
32
+ git (>= 1.2.5)
33
+ github_api
34
+ highline (>= 1.6.15)
35
+ nokogiri (>= 1.5.10)
36
+ rake
37
+ rdoc
38
+ json (1.8.3)
39
+ jwt (1.5.1)
40
+ method_source (0.8.2)
41
+ mini_portile (0.6.2)
42
+ multi_json (1.11.2)
43
+ multi_xml (0.5.5)
44
+ multipart-post (2.0.0)
45
+ nokogiri (1.6.6.2)
46
+ mini_portile (~> 0.6.0)
47
+ oauth2 (1.0.0)
48
+ faraday (>= 0.8, < 0.10)
49
+ jwt (~> 1.0)
50
+ multi_json (~> 1.3)
51
+ multi_xml (~> 0.5)
52
+ rack (~> 1.2)
53
+ pry (0.10.1)
54
+ coderay (~> 1.1.0)
55
+ method_source (~> 0.8.1)
56
+ slop (~> 3.4)
57
+ rack (1.6.4)
58
+ rake (10.4.2)
59
+ rdoc (4.2.0)
60
+ json (~> 1.4)
61
+ rspec (3.3.0)
62
+ rspec-core (~> 3.3.0)
63
+ rspec-expectations (~> 3.3.0)
64
+ rspec-mocks (~> 3.3.0)
65
+ rspec-collection_matchers (1.1.2)
66
+ rspec-expectations (>= 2.99.0.beta1)
67
+ rspec-core (3.3.2)
68
+ rspec-support (~> 3.3.0)
69
+ rspec-expectations (3.3.1)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.3.0)
72
+ rspec-mocks (3.3.2)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.3.0)
75
+ rspec-support (3.3.0)
76
+ simplecov (0.10.0)
77
+ docile (~> 1.1.0)
78
+ json (~> 1.8)
79
+ simplecov-html (~> 0.10.0)
80
+ simplecov-html (0.10.0)
81
+ simplecov-rcov (0.2.3)
82
+ simplecov (>= 0.4.1)
83
+ slop (3.6.0)
84
+ thread_safe (0.3.5)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ docker-api (~> 1.22)
91
+ excon (~> 0.45)
92
+ fakefs
93
+ jeweler (~> 2.0)
94
+ pry (~> 0.10)
95
+ rake (~> 10.0)
96
+ rspec (~> 3.0)
97
+ rspec-collection_matchers
98
+ simplecov (~> 0.9)
99
+ simplecov-rcov (~> 0.2)
100
+
101
+ BUNDLED WITH
102
+ 1.10.5
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ripta Pasay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # drydock
2
+
3
+ (WORK IN PROGRESS)
4
+
5
+ A ruby DSL to build your own docker images. Images are built based on instructions
6
+ contained in your project's `Drydockfile`.
7
+
8
+ ## Why not Dockerfile?
9
+
10
+ [Dockerfiles](https://docs.docker.com/reference/builder/) are great to start out
11
+ with, but:
12
+
13
+ 1. **They are static,** which isn't necessarily a bad thing. I'm not opposed to
14
+ a declarative approach to building images, but _sometimes_ it may be limiting.
15
+ 2. **They are less hackable,** because `docker build` doesn't support plugins
16
+ to expand its capabilities.
17
+ 3. **More complicated build pipelines are hard to implement,** or perhaps even
18
+ impossible. For instance, being able to build multiple images, then combine them
19
+ at the end, would be a nice option. Imagine building your ruby gem dependencies
20
+ and node.js dependencies separately, before combining both images into your
21
+ application's final image.
22
+ 4. **Caching rules are fairly limiting.** For instance, when your Gemfile changes,
23
+ it would be nice to import a configurably-older image, import the new Gemfile,
24
+ and re-run the build. On the other hand, it would be important to be able to limit
25
+ the age of the cache.
26
+
27
+ ## Why Drydock?
28
+
29
+ Drydock interfaces directly with the [Docker Remote API](https://docs.docker.com/reference/api/docker_remote_api/)
30
+ via [the docker-api gem](https://github.com/swipely/docker-api/). It's
31
+ not for every use case, but it provides great control over what and how an image
32
+ is built.
33
+
34
+ Drydock supports plugins, either provided through ruby gems or ruby files included
35
+ in your project being built by Drydock.
36
+
37
+ Drydockfiles are written in ruby.
38
+
39
+ ## Production Installation
40
+
41
+ Either (a) `gem install drydock`, or (b) add "drydock" to your project's Gemfile,
42
+ and run `bundle`.
43
+
44
+ In your project's root directory, you'll want to create a `Drydockfile` containing
45
+ drydock functions. When you're ready, build an image using:
46
+
47
+ ```
48
+ $ drydock
49
+ ```
50
+
51
+ Alternatively, point drydock to a directory containing the `Drydockfile`, or to any
52
+ file to treat it as the `Drydockfile`, e.g.:
53
+
54
+ ```
55
+ $ drydock ~/source/miniproject # project directory expects a file named Drydockfile
56
+ $ drydock ~/source/miniproject/drydock-definition.rb # expects a drydock-definition.rb
57
+ ```
58
+
59
+ Example `Drydockfile`s may be seen in `examples/`.
60
+
61
+ ## Development Installation
62
+
63
+ This is needed if you plan on hacking drydock:
64
+
65
+ ```
66
+ $ git clone git@github.com:ripta/drydock.git
67
+ $ bundle
68
+ ```
69
+
70
+ ## Roadmap
71
+
72
+ 1. Customizable caching subsystem.
73
+ 2. Derived docker images from a previous build step.
74
+ 3. Composable docker images.
75
+ 4. Customizable caching rules.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "dry-dock"
18
+ gem.homepage = "http://github.com/ripta/drydock"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Docker Image Pipeline DSL}
21
+ gem.description = %Q{A Dockerfile-replacement DSL for building complex images}
22
+ gem.email = "github@r8y.org"
23
+ gem.authors = ["Ripta Pasay"]
24
+
25
+ # dependencies defined in Gemfile
26
+ end
27
+
28
+ Jeweler::RubygemsDotOrgTasks.new
29
+
30
+ require 'rake/testtask'
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.libs << 'lib' << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+
37
+ desc "Code coverage detail"
38
+ task :simplecov do
39
+ ENV['COVERAGE'] = "true"
40
+ Rake::Task['test'].execute
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rdoc/task'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "drydock #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/drydock ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'drydock'
4
+
5
+ opts = Drydock::RuntimeOptions.parse!(ARGV)
6
+
7
+ STDOUT.sync = true
8
+ Drydock.logger = Drydock::Logger.new(STDOUT).tap do |l|
9
+ l.level = opts.log_level
10
+ l.formatter = Drydock::Formatter.new
11
+ end
12
+
13
+ build_opts = {}
14
+ build_opts[:event_handler] = Proc.new do |event, is_new, serial, event_type|
15
+ long_id = event.id.to_s
16
+ short_id = if long_id.include?(':') || long_id.include?('/')
17
+ long_id
18
+ else
19
+ long_id.slice(0, 12)
20
+ end
21
+
22
+ if is_new
23
+ Drydock.logger.info(message: "#{event_type.to_s.capitalize} #{short_id} #{event.status}")
24
+ else
25
+ Drydock.logger.debug(message: "#{event_type.to_s.capitalize} #{short_id} #{event.status}")
26
+ end
27
+ end
28
+ build_opts[:cache] = Drydock::ObjectCaches::FilesystemCache.new if opts.cache
29
+
30
+ Drydock.build(build_opts) do |project|
31
+ Drydock.logger.info Drydock.banner
32
+
33
+ filename = ARGV.first || 'Drydockfile'
34
+ filename = "#{filename}/Drydockfile" if File.directory?(filename)
35
+
36
+ unless File.exist?(filename)
37
+ Drydock.logger.error "Cannot find file #{filename} in #{Dir.pwd}"
38
+ exit 1
39
+ end
40
+
41
+ contents = File.read(filename)
42
+ Drydock.logger.info "Loaded #{contents.length} bytes from #{filename}"
43
+
44
+ [contents, filename]
45
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'oj'
4
+
5
+ STDOUT.sync = true
6
+
7
+ Oj.load(STDIN, Oj.default_options.merge(indent: -1)) do |json|
8
+ puts json.inspect
9
+ end
10
+
11
+
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ STDOUT.sync = true
4
+
5
+ puts '{"status":"Pulling repository docker.io/gliderlabs/alpine"}'
6
+ sleep 2
7
+
8
+ print '{"status":"Pulling image (latest) from docker.io/gliderlabs/alpine","progressDetail":{},"id":"5bd56d818842"}'
9
+ print '{"status":"Pulling image (latest) from docker.io/gliderlabs/alpine, endpoint: https://registry-1.docker.io/v1/","progressDetail":{},"id":"5bd56d818842"}'
10
+ sleep 2
11
+
12
+ puts '{"status":"Pulling dependent layers","progressDetail":{},"id":"5bd56d818842"}'
13
+ sleep 1
14
+
15
+ print '{"status":"Download complete","progressDetail":{},"id":"511136ea3c5a"}'
16
+ sleep 1
17
+
18
+ print '{"status":"Download complete","progressDetail":{},"id":"5bd56d818842"}'
19
+ sleep 1
20
+
21
+ print '{"status":"Download complete","progressDetail":{},"id":"5bd56d818842"}'
22
+ sleep 1
23
+
24
+ print '{"status":"Status: Image is up to date for gliderlabs/alpine:latest"}'
25
+
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'docker'
4
+ require_relative '../lib/drydock'
5
+
6
+ def build_tar(*source_files)
7
+ buffer = StringIO.new
8
+ # Gem::Package::TarWriter
9
+ Drydock::TarWriter.new(buffer) do |tar|
10
+ source_files.each do |source_file|
11
+ File.open(source_file, 'r') do |input|
12
+ tar.add_entry(source_file, mode: input.stat.mode, mtime: input.stat.mtime) do |tar_file|
13
+ tar_file.write(input.read)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ buffer.rewind
20
+ Digest::MD5.hexdigest(buffer.read)
21
+ end
22
+
23
+ files = Dir.glob('./*').reject { |path| File.directory?(path) }
24
+
25
+ puts build_tar(*files)
26
+ sleep 2
27
+ puts build_tar(*files)
data/dry-dock.gemspec ADDED
@@ -0,0 +1,135 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: dry-dock 0.1.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "dry-dock"
9
+ s.version = "0.1.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Ripta Pasay"]
14
+ s.date = "2015-09-30"
15
+ s.description = "A Dockerfile-replacement DSL for building complex images"
16
+ s.email = "github@r8y.org"
17
+ s.executables = ["drydock", "json-test-consumer.rb", "json-test-producer.rb", "test-tar-writer-digest.rb"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".dockerignore",
24
+ ".pryrc",
25
+ ".rspec",
26
+ "Dockerfile",
27
+ "Gemfile",
28
+ "Gemfile.lock",
29
+ "LICENSE",
30
+ "README.md",
31
+ "Rakefile",
32
+ "VERSION",
33
+ "bin/drydock",
34
+ "bin/json-test-consumer.rb",
35
+ "bin/json-test-producer.rb",
36
+ "bin/test-tar-writer-digest.rb",
37
+ "dry-dock.gemspec",
38
+ "examples/ruby-dsl.rb",
39
+ "examples/ruby-node-app-dsl.rb",
40
+ "examples/test-dsl.rb",
41
+ "examples/test.rb",
42
+ "lib/drydock.rb",
43
+ "lib/drydock/cli_flags.rb",
44
+ "lib/drydock/container_config.rb",
45
+ "lib/drydock/docker_api_patch.rb",
46
+ "lib/drydock/drydock.rb",
47
+ "lib/drydock/errors.rb",
48
+ "lib/drydock/file_manager.rb",
49
+ "lib/drydock/formatters.rb",
50
+ "lib/drydock/ignorefile_definition.rb",
51
+ "lib/drydock/image_repository.rb",
52
+ "lib/drydock/logger.rb",
53
+ "lib/drydock/object_caches/base.rb",
54
+ "lib/drydock/object_caches/filesystem_cache.rb",
55
+ "lib/drydock/object_caches/in_memory_cache.rb",
56
+ "lib/drydock/object_caches/no_cache.rb",
57
+ "lib/drydock/phase.rb",
58
+ "lib/drydock/phase_chain.rb",
59
+ "lib/drydock/plugins/apk.rb",
60
+ "lib/drydock/plugins/base.rb",
61
+ "lib/drydock/plugins/npm.rb",
62
+ "lib/drydock/plugins/package_manager.rb",
63
+ "lib/drydock/plugins/rubygems.rb",
64
+ "lib/drydock/project.rb",
65
+ "lib/drydock/runtime_options.rb",
66
+ "lib/drydock/stream_monitor.rb",
67
+ "lib/drydock/tar_writer.rb",
68
+ "spec/assets/MANIFEST",
69
+ "spec/assets/hello-world.txt",
70
+ "spec/assets/sample.tar",
71
+ "spec/assets/test.sh",
72
+ "spec/drydock/cli_flags_spec.rb",
73
+ "spec/drydock/container_config_spec.rb",
74
+ "spec/drydock/docker_api_patch_spec.rb",
75
+ "spec/drydock/drydock_spec.rb",
76
+ "spec/drydock/file_manager_spec.rb",
77
+ "spec/drydock/formatters_spec.rb",
78
+ "spec/drydock/ignorefile_definition_spec.rb",
79
+ "spec/drydock/image_repository_spec.rb",
80
+ "spec/drydock/object_caches/base_spec.rb",
81
+ "spec/drydock/object_caches/filesystem_cache_spec.rb",
82
+ "spec/drydock/object_caches/no_cache_spec.rb",
83
+ "spec/drydock/phase_chain_spec.rb",
84
+ "spec/drydock/phase_spec.rb",
85
+ "spec/drydock/plugins/apk_spec.rb",
86
+ "spec/drydock/plugins/base_spec.rb",
87
+ "spec/drydock/plugins/npm_spec.rb",
88
+ "spec/drydock/plugins/package_manager_spec.rb",
89
+ "spec/drydock/plugins/rubygems_spec.rb",
90
+ "spec/drydock/project_import_spec.rb",
91
+ "spec/drydock/project_spec.rb",
92
+ "spec/drydock/runtime_options_spec.rb",
93
+ "spec/drydock/stream_monitor_spec.rb",
94
+ "spec/drydock/tar_writer_spec.rb",
95
+ "spec/spec_helper.rb",
96
+ "spec/support/shared_examples/base_class.rb",
97
+ "spec/support/shared_examples/container_config.rb",
98
+ "spec/support/shared_examples/drydockfile.rb"
99
+ ]
100
+ s.homepage = "http://github.com/ripta/drydock"
101
+ s.licenses = ["MIT"]
102
+ s.rubygems_version = "2.2.2"
103
+ s.summary = "Docker Image Pipeline DSL"
104
+
105
+ if s.respond_to? :specification_version then
106
+ s.specification_version = 4
107
+
108
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
109
+ s.add_runtime_dependency(%q<docker-api>, ["~> 1.22"])
110
+ s.add_runtime_dependency(%q<excon>, ["~> 0.45"])
111
+ s.add_development_dependency(%q<rake>, ["~> 10.0"])
112
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
113
+ s.add_development_dependency(%q<pry>, ["~> 0.10"])
114
+ s.add_development_dependency(%q<simplecov>, ["~> 0.9"])
115
+ s.add_development_dependency(%q<simplecov-rcov>, ["~> 0.2"])
116
+ else
117
+ s.add_dependency(%q<docker-api>, ["~> 1.22"])
118
+ s.add_dependency(%q<excon>, ["~> 0.45"])
119
+ s.add_dependency(%q<rake>, ["~> 10.0"])
120
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
121
+ s.add_dependency(%q<pry>, ["~> 0.10"])
122
+ s.add_dependency(%q<simplecov>, ["~> 0.9"])
123
+ s.add_dependency(%q<simplecov-rcov>, ["~> 0.2"])
124
+ end
125
+ else
126
+ s.add_dependency(%q<docker-api>, ["~> 1.22"])
127
+ s.add_dependency(%q<excon>, ["~> 0.45"])
128
+ s.add_dependency(%q<rake>, ["~> 10.0"])
129
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
130
+ s.add_dependency(%q<pry>, ["~> 0.10"])
131
+ s.add_dependency(%q<simplecov>, ["~> 0.9"])
132
+ s.add_dependency(%q<simplecov-rcov>, ["~> 0.2"])
133
+ end
134
+ end
135
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env drydock
2
+
3
+ from 'gliderlabs/alpine', '3.2'
4
+
5
+ with Plugins::APK do |pkg|
6
+ pkg.update
7
+ pkg.upgrade
8
+ pkg.add 'ruby', 'ruby-dev'
9
+ pkg.add 'curl'
10
+ end
11
+
12
+ download_once 'https://github.com/tianon/gosu/releases/download/1.3/gosu-amd64', '/bin/gosu', chmod: 0755
13
+
14
+ run 'sleep 2 && date && sleep 2 && date && sleep 2 && date && sleep 2 && date', no_cache: true