Class: Docker::Template::Common
Constant Summary collapse
- CopyMethods =
[ :setup_context, :copy_global, :copy_all, :copy_type, :copy_tag, :build_context, :verify_context].freeze
Instance Method Summary collapse
- #aliased? ⇒ Boolean
- #build ⇒ Object
- #chdir_build ⇒ Object
- #parent_img ⇒ Object
- #parent_repo ⇒ Object
- #push ⇒ Object
- #rootfs? ⇒ Boolean
Instance Method Details
#aliased? ⇒ Boolean
24 25 26 |
# File 'lib/docker/template/common.rb', line 24 def aliased? @repo.tag != @repo.aliased && !rootfs? end |
#build ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/docker/template/common.rb', line 56 def build return Alias.new(self).build if aliased? Ansi.clear Util.notify_build(@repo, rootfs: rootfs?) copy_build_and_verify chdir_build rescue SystemExit => exit_ unlink img: true raise exit_ ensure if rootfs? unlink img: false else unlink end end |
#chdir_build ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/docker/template/common.rb', line 74 def chdir_build Dir.chdir(@context) do @img = Docker::Image.build_from_dir(".", &Stream.new.method(:log)) @img.tag rootfs?? @repo.to_rootfs_h : @repo.to_tag_h push end end |
#parent_img ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/docker/template/common.rb', line 45 def parent_img return false unless aliased? @parent_img ||= Docker::Image.get(parent_repo.to_s) rescue Docker::Error::NotFoundError if aliased? nil end end |
#parent_repo ⇒ Object
36 37 38 39 40 41 |
# File 'lib/docker/template/common.rb', line 36 def parent_repo return false unless aliased? @parent_repo ||= begin Repo.new(@repo.to_h.merge("tag" => @repo.aliased)) end end |
#push ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/docker/template/common.rb', line 13 def push return if rootfs? || !Interface.push? Auth.auth! img = @img || Docker::Image.get(@repo.to_s) logger = Stream.new.method(:log) img.push(&logger) end |
#rootfs? ⇒ Boolean
30 31 32 |
# File 'lib/docker/template/common.rb', line 30 def rootfs? false end |