Class: Space::Core::OciBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/space_core/oci_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(space:, output_dir:) ⇒ OciBuilder

Returns a new instance of OciBuilder.



11
12
13
14
# File 'lib/space_core/oci_builder.rb', line 11

def initialize(space:, output_dir:)
  @space = space
  @output_dir = Pathname.new(output_dir)
end

Instance Method Details

#commandObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/space_core/oci_builder.rb', line 28

def command
  compute_version.fmap do |ver|
    [
      "container", "build",
      "-f", @output_dir.join("Dockerfile").to_s,
      "-t", "#{space.id}:#{ver}",
      "-t", latest,
      space.path.to_s
    ]
  end
end

#imageObject



20
21
22
# File 'lib/space_core/oci_builder.rb', line 20

def image
  "#{space.id}:#{version}"
end

#latestObject



24
25
26
# File 'lib/space_core/oci_builder.rb', line 24

def latest
  "#{space.id}:latest"
end

#versionObject



16
17
18
# File 'lib/space_core/oci_builder.rb', line 16

def version
  compute_version.value!
end