improve build
This commit is contained in:
parent
31b15c200e
commit
7b3345bacc
|
@ -1,5 +1,5 @@
|
|||
FROM gliderlabs/alpine
|
||||
|
||||
ADD build/discourse-auth-proxy /bin/discourse-auth-proxy
|
||||
ADD build_image/discourse-auth-proxy /bin/discourse-auth-proxy
|
||||
|
||||
CMD ["/bin/discourse-auth-proxy"]
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
require 'pty'
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
def run(command)
|
||||
lines = []
|
||||
PTY.spawn(command) do |stdin, stdout, pid|
|
||||
begin
|
||||
stdin.each do |line|
|
||||
lines << line
|
||||
puts line
|
||||
end
|
||||
rescue Errno::EIO
|
||||
# we are done
|
||||
end
|
||||
end
|
||||
|
||||
lines
|
||||
end
|
||||
|
||||
|
||||
def build(path)
|
||||
lines = run("cd #{path} && docker build --nocache .")
|
||||
lines[-1]["successfully built ".length..-1].strip
|
||||
end
|
||||
|
||||
img = build("build_image")
|
||||
pwd = `pwd`.strip
|
||||
run "docker run --rm -it -v #{pwd}/build_image:/shared #{img}"
|
||||
|
||||
repo = "samsaffron/discourse-auth-proxy"
|
||||
tag = "#{repo}:#{version}"
|
||||
latest = "#{repo}:#{latest}"
|
||||
|
||||
img = build(".")
|
||||
run "docker tag #{img} #{tag}"
|
||||
run "docker tag #{img} #{latest}"
|
||||
|
||||
|
Loading…
Reference in New Issue