Sha256: 95f101a1d54235cb6a48f6135fd3e2fa7d1dcd36c21b9dacd2b24b28cfb2a44a

Contents?: true

Size: 815 Bytes

Versions: 12

Compression:

Stored size: 815 Bytes

Contents

# frozen_string_literal: true

module Jive
  class Docker
    attr_reader :shell

    def initialize(shell = ::Jive.shell)
      @shell = shell
    end

    def build(path)
      shell.execute([
        "docker",
        "build",
        "--network=host",
        "-t", image_tag_for(path),
        "."
      ], env: { "DOCKER_BUILDKIT" => "1" })
    end

    def launch(path)
      shell.execute([
        "docker",
        "run",
        "--network=host",
        '--entrypoint=""',
        "-it", image_tag_for(path),
        "/bin/bash -l"
      ])
    end

    def size(path)
      shell.execute([
        :docker, "image", "inspect", '--format="{{.Size}}"',
        image_tag_for(path)
      ])
    end

    private

    def image_tag_for(path)
      "#{path.basename.to_s.downcase}:latest"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jive-0.7.0 lib/jive/docker.rb
jive-0.6.0 lib/jive/docker.rb
jive-0.5.0 lib/jive/docker.rb
jive-0.4.4 lib/jive/docker.rb
jive-0.4.3 lib/jive/docker.rb
jive-0.4.2 lib/jive/docker.rb
jive-0.4.1 lib/jive/docker.rb
jive-0.4.0 lib/jive/docker.rb
jive-0.3.3 lib/jive/docker.rb
jive-0.3.2 lib/jive/docker.rb
jive-0.3.1 lib/jive/docker.rb
jive-0.3.0 lib/jive/docker.rb