class Dapp::Dimg::Build::Stage::From
Public Instance Methods
dependencies()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 6 def dependencies @dependencies ||= [from_image_name, dimg.config._docker._from_cache_version, config_mounts] end
save_in_cache!()
click to toggle source
Calls superclass method
Dapp::Dimg::Build::Stage::Base#save_in_cache!
# File lib/dapp/dimg/build/stage/from.rb, line 10 def save_in_cache! super from_dimg.last_stage.save_in_cache! unless from_dimg.nil? end
Protected Instance Methods
add_cleanup_mounts_dirs_command()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 50 def add_cleanup_mounts_dirs_command return if config_mounts_dirs.empty? image.add_service_command ["#{dimg.dapp.rm_bin} -rf %s", "#{dimg.dapp.mkdir_bin} -p %s", "#{dimg.dapp.rm_bin} -rf %s"].map { |c| format(c, config_mounts_dirs.join(' ')) } end
config_mounts()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 57 def config_mounts {}.tap do |mounts| [:tmp_dir, :build_dir].map { |type| mounts[type] = config_mounts_by_type(type) } config_custom_dir_mounts.each { |from, to| mounts[from] = to } end end
config_mounts_dirs()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 64 def config_mounts_dirs config_mounts.values.flatten.uniq end
from_dimg()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 31 def from_dimg @from_dimg ||= begin if !dimg.config._from_dimg.nil? dimg.dapp.dimg_layer(config: dimg.config._from_dimg) elsif !dimg.config._from_dimg_artifact.nil? dimg.dapp.artifact_dimg_layer(config: dimg.config._from_dimg_artifact) end end end
image_add_mounts()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 68 def image_add_mounts image_add_mounts_labels end
image_should_be_untagged_condition()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 72 def image_should_be_untagged_condition false end
prepare_image()
click to toggle source
Calls superclass method
Dapp::Dimg::Build::Stage::Base#prepare_image
# File lib/dapp/dimg/build/stage/from.rb, line 17 def prepare_image if !from_dimg.nil? process = dimg.dapp.t(code: 'process.from_dimg_building', data: { name: from_dimg.name }) dimg.dapp.log_secondary_process(process) { from_dimg.build! } elsif !from_image.tagged? try_host_docker_login from_image.pull! raise Error::Build, code: :from_image_not_found, data: { name: from_image_name } unless from_image.tagged? end add_cleanup_mounts_dirs_command super end
registry_from_image_name?()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 46 def registry_from_image_name? ENV['CI_REGISTRY'] && from_image_name.start_with?(ENV['CI_REGISTRY']) end
should_not_be_detailed?()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 76 def should_not_be_detailed? from_image.tagged? end
try_host_docker_login()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 41 def try_host_docker_login return unless registry_from_image_name? dimg.dapp.host_docker_login(ENV['CI_REGISTRY']) end
Private Instance Methods
from_image()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 90 def from_image @from_image ||= begin if !from_dimg.nil? from_dimg.last_stage.image else Image::Stage.image_by_name(name: from_image_name, dapp: dimg.dapp) end end end
from_image_name()
click to toggle source
# File lib/dapp/dimg/build/stage/from.rb, line 82 def from_image_name if !from_dimg.nil? from_dimg.signature else dimg.config._docker._from end end