class Jive::Docker

Attributes

shell[R]

Public Class Methods

new(shell = ::Jive.shell) click to toggle source
# File lib/jive/docker.rb, line 7
def initialize(shell = ::Jive.shell)
  @shell = shell
end

Public Instance Methods

build(path) click to toggle source
# File lib/jive/docker.rb, line 11
def build(path)
  shell.execute([
    "docker",
    "build",
    "--network=host",
    "-t", image_tag_for(path),
    "."
  ], env: { "DOCKER_BUILDKIT" => "1" })
end
launch(path) click to toggle source
# File lib/jive/docker.rb, line 21
def launch(path)
  shell.execute([
    "docker",
    "run",
    "--network=host",
    '--entrypoint=""',
    "-it", image_tag_for(path),
    "/bin/bash -l"
  ])
end
size(path) click to toggle source
# File lib/jive/docker.rb, line 32
def size(path)
  shell.execute([
    :docker, "image", "inspect", '--format="{{.Size}}"',
    image_tag_for(path)
  ])
end

Private Instance Methods

image_tag_for(path) click to toggle source
# File lib/jive/docker.rb, line 41
def image_tag_for(path)
  "#{path.basename.to_s.downcase}:latest"
end