Class: Kuby::Docker::BundlerPhase
- Defined in:
- lib/kuby/docker/bundler_phase.rb
Constant Summary collapse
- DEFAULT_WITHOUT =
['development', 'test', 'deploy'].freeze
Instance Attribute Summary collapse
-
#gemfile ⇒ Object
Returns the value of attribute gemfile.
-
#version ⇒ Object
Returns the value of attribute version.
-
#without ⇒ Object
Returns the value of attribute without.
Attributes inherited from Phase
Instance Method Summary collapse
Methods inherited from Phase
Constructor Details
This class inherits a constructor from Kuby::Docker::Phase
Instance Attribute Details
#gemfile ⇒ Object
Returns the value of attribute gemfile.
6 7 8 |
# File 'lib/kuby/docker/bundler_phase.rb', line 6 def gemfile @gemfile end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/kuby/docker/bundler_phase.rb', line 6 def version @version end |
#without ⇒ Object
Returns the value of attribute without.
6 7 8 |
# File 'lib/kuby/docker/bundler_phase.rb', line 6 def without @without end |
Instance Method Details
#apply_to(dockerfile) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kuby/docker/bundler_phase.rb', line 8 def apply_to(dockerfile) gf = gemfile || default_gemfile lf = "#{gf}.lock" v = version || default_version wo = without || DEFAULT_WITHOUT dockerfile.run("gem install bundler -v #{v}") # bundle install dockerfile.copy(gf, '.') dockerfile.copy(lf, '.') # set bundle path so docker will cache the bundle dockerfile.run('mkdir ./bundle') dockerfile.env('BUNDLE_PATH=./bundle') unless wo.empty? dockerfile.env("BUNDLE_WITHOUT='#{wo.join(' ')}'") end dockerfile.run( 'bundle', 'install', '--jobs', '$(nproc)', '--retry', '3', '--gemfile', gf ) # generate binstubs and add the bin directory to our path dockerfile.run('bundle binstubs --all') dockerfile.env("PATH=./bin:$PATH") end |