class LambdaRubyBundler::Container
Wrapper around [Docker::Container] for creating, running and removing bundler containers. @api private
Attributes
app_path[R]
build_dependencies[R]
root_path[R]
volume[R]
Public Class Methods
new(root_path, app_path, volume, build_dependencies)
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 10 def initialize(root_path, app_path, volume, build_dependencies) @root_path = root_path @app_path = app_path @volume = volume @build_dependencies = build_dependencies end
Public Instance Methods
destroy()
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 23 def destroy container.remove @container = nil end
run(timeout: 120)
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 17 def run(timeout: 120) container.start container.attach({}, read_timeout: timeout) end
Private Instance Methods
container()
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 30 def container @container ||= Docker::Container.create(container_arguments) end
container_arguments()
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 34 def container_arguments { 'Cmd' => [app_path, build_dependencies ? 'use-deps' : 'no-deps'], 'Image' => Image.instance.id, 'HostConfig' => { 'AutoRemove' => true, 'Mounts' => mounts } } end
mounts()
click to toggle source
# File lib/lambda_ruby_bundler/container.rb, line 43 def mounts [ { 'Target' => '/app', 'Source' => root_path, 'Type' => 'bind', 'ReadOnly' => true }, { 'Target' => '/workspace/build/vendor/bundle', 'Source' => volume.id, 'Type' => 'volume' } ] end