Skip to content
Permalink
Browse files

hugely crude decking script to wrap docker builds

  • Loading branch information
makeusabrew committed Nov 5, 2013
0 parents commit a4dff2ea3b2a571acbbf04e00f9bb6f90cb1f01a
Showing with 31 additions and 0 deletions.
  1. +31 −0 bin/decking
@@ -0,0 +1,31 @@
#!/usr/bin/env coffee

fs = require "fs"
child_process = require "child_process"

source = process.argv[2]
image = process.argv[3]
context = process.argv[4] || process.cwd()
path = context + "/Dockerfile"

fs.symlinkSync source, path

buffer = fs.readFileSync path
str = buffer.toString "utf8"

[head, tail...] = str.split "\n"

matches = head.match /build as (.+)$/

throw "No valid meta line found" if not matches

image = matches[1]
console.log "Building docker image #{image}...\n"

db = child_process.spawn "docker", ["build", "-t", image, context]

db.stdout.on "data", (d) -> process.stdout.write d
db.stderr.on "data", (d) -> process.stderr.write d

db.on "exit", (code) ->
fs.unlinkSync path

0 comments on commit a4dff2e

Please sign in to comment.
You can’t perform that action at this time.