Skip to content

Instantly share code, notes, and snippets.

@jwo
Created October 26, 2017 20:52
Show Gist options
  • Save jwo/c12b96fa5c3bcf7a2a4a43df3e79bbd2 to your computer and use it in GitHub Desktop.
Save jwo/c12b96fa5c3bcf7a2a4a43df3e79bbd2 to your computer and use it in GitHub Desktop.
Node app which uses dockerode to run a simple test suite against a Git Repo.
git clone $1 /tmp/app
cd /tmp/app
git checkout $2
write-good *.md
FROM node:8
RUN npm install -g write-good
ADD clone-run.sh /tmp/clone-run.sh
console.log("Just Playing Along")
var Docker = require("dockerode")
var docker = new Docker({ socketPath: "/var/run/docker.sock" })
console.log("Started")
docker
.run(
"4d55c12364a5", // in the `images` folder, run `docker build .` and get the container ID
["bash", "/tmp/clone-run.sh", "https://github.com/jwo/react-hover-image", "SHA-or-REF"],
process.stdout
)
.then(function(container) {
return container.remove()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment