lib/ufo/docker/builder.rb in ufo-4.4.3 vs lib/ufo/docker/builder.rb in ufo-4.5.0

- old
+ new

@@ -21,16 +21,16 @@ def build start_time = Time.now store_full_image_name - update_auth_token - command = "docker build #{build_options}-t #{full_image_name} -f #{@dockerfile} ." say "Building docker image with:".color(:green) say " #{command}".color(:green) + compile_dockerfile_erb check_dockerfile_exists + update_auth_token command = "cd #{Ufo.root} && #{command}" success = execute(command, use_system: true) unless success docker_version_success = system("docker version > /dev/null 2>&1") unless docker_version_success @@ -79,10 +79,14 @@ def pusher @pusher ||= Pusher.new(full_image_name, @options) end + def compile_dockerfile_erb + Compiler.new("#{Ufo.root}/#{@dockerfile}").compile + end + def check_dockerfile_exists unless File.exist?("#{Ufo.root}/#{@dockerfile}") puts "#{@dockerfile} does not exist. Are you sure it exists?" exit 1 end @@ -137,11 +141,15 @@ @git_sha = `cd #{Ufo.root} && git rev-parse --short HEAD` @git_sha.strip! end def update_dockerfile - dockerfile = Dockerfile.new(full_image_name, @options) - dockerfile.update + updater = if File.exist?("#{Ufo.root}/Dockerfile.erb") # dont use @dockerfile on purpose + Variables.new(full_image_name, @options) + else + Dockerfile.new(full_image_name, @options) + end + updater.update end def say(msg) puts msg unless @options[:mute] end