Sha256: b41b92a6385ee82af192cb4dfcd2cf8ce24bc0f5e2aa4a61ede1afae84eb1cd2
Contents?: true
Size: 989 Bytes
Versions: 36
Compression:
Stored size: 989 Bytes
Contents
module Ufo::Docker class Dockerfile include Ufo::Utils::Logging def initialize(docker_image, options={}) @docker_image, @options = docker_image, options end def update write_new_dockerfile end def current_dockerfile @current_dockerfile ||= IO.read(dockerfile_path) end def dockerfile_path "#{Ufo.root}/Dockerfile" end def new_dockerfile lines = current_dockerfile.split("\n") # replace FROM line new_lines = lines.map do |line| if line =~ /^FROM / "FROM #{@docker_image}" else line end end new_lines.join("\n") + "\n" end def write_new_dockerfile IO.write(dockerfile_path, new_dockerfile) logger.debug <<~EOL The Dockerfile FROM statement has been updated with the latest base image: #{@docker_image} EOL end end end
Version data entries
36 entries across 36 versions & 1 rubygems