Class: Space::Core::OciPacker
- Inherits:
-
Object
- Object
- Space::Core::OciPacker
- Defined in:
- lib/space_core/oci_packer.rb
Constant Summary collapse
- TEMPLATE_DIR =
Pathname.new(__dir__).join("templates", "oci").freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(space:, output_dir:) ⇒ OciPacker
constructor
A new instance of OciPacker.
Constructor Details
#initialize(space:, output_dir:) ⇒ OciPacker
Returns a new instance of OciPacker.
14 15 16 17 |
# File 'lib/space_core/oci_packer.rb', line 14 def initialize(space:, output_dir:) @space = space @output_dir = Pathname.new(output_dir) end |
Instance Method Details
#generate ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/space_core/oci_packer.rb', line 19 def generate FileUtils.mkdir_p(@output_dir) validated = validate_provision_scripts(space.provision_scripts) return validated if validated.failure? validated = validate_persist_paths(space.persist_paths) return validated if validated.failure? write("Dockerfile", render_template("dockerfile.erb")) write("entrypoint.sh", entrypoint_content, mode: 0o755) write("Dockerfile.dockerignore", render_template("dockerignore.erb")) Success(@output_dir) rescue StandardError => e Failure(e) end |