0.1.0 • Published 11 years ago
build-docker-image-from-tarball v0.1.0
Build From Tarball
Module that takes a path to a git archive tarball and uses heroku-style buildpackg to build the repo into a docker image.
Requirements
You will need the following installed. To get started you can use the supplied vagrant file which automatically installs docker and node.js on startup
Docker
The docker daemon must be installed and running. Visit https://docker.io for instructions on installing docker
Buildstep base image
A valid buildstep base docker image must be available in the list of docker images. There is an image available in the public docker index that will work if you do not wish to build your own
docker pull nisaacson/buildstep
# optionally tag this image with your own name
# docker tag nisaacson/buildstep foo_buildstep
Installation
npm install -S build-docker-image-from-tarball
Usage
Specfiy the following
sourcePath: /path/to/git/archive.tar.gz
buildImage: foo_buildstep
base image that containers the builder script and heroku buildpacksdestImageName
foo_app
the name of the image that will be built and appear indocker images
once the build completes
var buildFromTarball = require('build-from-tarball')
var data = {
sourcePath: '/path/to/git/archive.tar.gz',
buildImage: 'foo_buildstep',
destImageName: 'foo_app'
}
buildFromTarball(data, function(err) {
if (err) {
console.dir('failed to build docker image from git archive tarball', err)
return
}
console.log('image built correctly. You should now see the image %s when you execute `docker images`', data.destImageName)
})
Tests
# create the default VM
vagrant up
# log into the VM via ssh
vagrant ssh
# navigate to the repo root directory
cd /vagrant
# install development dependencies
npm install
# run the tests
npm test