lib/avm/docker/runner.rb in avm-tools-0.100.0 vs lib/avm/docker/runner.rb in avm-tools-0.101.0
- old
+ new
@@ -41,43 +41,69 @@
def banner
infov 'Registry name', registry
infov 'Version?', version?
infov 'Snapshot?', snapshot?
- infov 'Image name', instance.docker_image.tag
+ infov 'Image name', docker_image.tag
infov 'Build arguments', build_args
infov 'Entrypoint arguments', entrypoint_args
end
def build
- instance.docker_image.build(build_args)
+ docker_image.build(build_args)
+ success 'Docker image builded'
end
def build_args
parsed.build_arg
end
+ def docker_container
+ instance.docker_container
+ end
+
+ def docker_image
+ instance.docker_image
+ end
+
def entrypoint_args
parsed.entrypoint_arg
end
def push
- instance.docker_image.push if parsed.push?
+ docker_image.push if parsed.push?
end
def container_run
return unless parsed.run?
- instance.docker_container.run(
+ docker_container.run(
entrypoint_args: entrypoint_args,
clear: parsed.clear?
)
end
def registry_uncached
- parsed.registry_name.if_present(::Avm::Docker::Registry.default) do |v|
- ::Avm::Docker::Registry.new(v)
+ registry_from_option || registry_from_instance || registry_from_default ||
+ fatal_error('No registry defined')
+ end
+
+ def registry_from_option
+ parsed.registry_name.if_present { |v| ::Avm::Docker::Registry.new(v) }
+ end
+
+ def registry_from_instance
+ if if_respond(:use_default_registry?, true)
+ instance.docker_registry_optional.if_present { |v| ::Avm::Docker::Registry.new(v) }
+ else
+ ::Avm::Docker::Registry.new(instance.docker_registry)
end
+ end
+
+ def registry_from_default
+ return nil unless if_respond(:use_default_registry?, true)
+
+ ::Avm::Docker::Registry.default
end
def snapshot?
!parsed.no_snapshot?
end