lib/kontena/cli/apps/docker_helper.rb in kontena-cli-0.11.0 vs lib/kontena/cli/apps/docker_helper.rb in kontena-cli-0.11.1
- old
+ new
@@ -24,14 +24,14 @@
!(/^[\w.\/\-]+:?+[\w+.]+$/ =~ name).nil?
end
def build_docker_image(name, path, dockerfile, no_cache=false)
- if no_cache
- ret = system("docker build -t #{name} -f #{dockerfile} --no-cache #{path}")
- else
- ret = system("docker build -t #{name} -f #{dockerfile} #{path}")
- end
+ cmd = ["docker build -t #{name}"]
+ cmd << "-f #{File.join(File.expand_path(path), dockerfile)}" if dockerfile != "Dockerfile"
+ cmd << "--no-cache" if no_cache
+ cmd << path
+ ret = system(cmd.join(' '))
abort("Failed to build image #{name.colorize(:cyan)}") unless ret
ret
end
def push_docker_image(image)