Class: Hako::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/hako/container.rb

Direct Known Subclasses

AppContainer, Front

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, definition, dry_run:) ⇒ Container

Returns a new instance of Container.



8
9
10
11
12
13
# File 'lib/hako/container.rb', line 8

def initialize(app, definition, dry_run:)
  @app = app
  @definition = default_config.merge(definition)
  @definition['docker_labels'].merge!(default_labels)
  @dry_run = dry_run
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



6
7
8
# File 'lib/hako/container.rb', line 6

def definition
  @definition
end

Instance Method Details

#envObject



31
32
33
# File 'lib/hako/container.rb', line 31

def env
  @expanded_env ||= expand_env(@definition.fetch('env', {}))
end

#mount_pointsObject



35
36
37
38
39
40
41
42
43
# File 'lib/hako/container.rb', line 35

def mount_points
  @definition['mount_points'].map do |mount_point|
    {
      source_volume: mount_point.fetch('source_volume'),
      container_path: mount_point.fetch('container_path'),
      read_only: mount_point.fetch('read_only', false),
    }
  end
end