spinup-tarstreams
Spins up tar streams each in it's own docker container.
var path = dockerifyRepo = spinup = var group = 'bmarkdown'; // we get a tar stream for each tagged release of thlorenz/browserify-markdown-editor// and launch a docker container for each to be able to inspect multiple versions of it ; { ;}
Installation
npm install spinup-tarstreams
API
-
spinupTarstreams(streamfns, opts, cb)
-
Creates images for each provided tar stream and then starts a container for each image that matches the given group.
This means that containers for already existing images can be started as well in order to allow reusing existing images instead of having to rebuild them for each run.
Containers are exposing the provided port and bind it to a unique port on the host machine.
This is the only API you will need most likely, all other functions are considered advanced API.
Parameters:
Name Type Argument Description streamfns
Array.<function()> functions that return a tar stream each
opts
Object <optional>
options that describe how each image and container is created and started
Properties
Name Type Argument Description loglevel
string <optional>
(default:
'info'
) if set logs will be written tostderr
(@see dockops:logEvents)container
Object <optional>
options that describe how each container is created and started (@see spinupTarstreams::runContainers)
dockerhost
string <optional>
(default:
$DOCKER_HOST or 'tcp://127.0.0.1:4243'
) the host that docker is running ongroup
string <optional>
(default:
'ungrouped'
) the group aka REPOSITORY to which the add the created images and whose containers to startuseExistingImages
boolean <optional>
(default:
true
) if false all images are created, even if one for the group and tag existscb
function when finished, calls back with all currently running containers for the given group or with an error
-
spinupTarstreams::buildImages(images, streamfns, group, useExisting, cb)
-
Builds an image for each
streamfn
for the given configuration.Parameters:
Name Type Description images
Object instance of initialized
{Images}
, it is also used to emit progress events overstreamfns
Object functions returning tar streams hashed by tag name
group
string group for which to build images (i.e. repo name)
useExisting
boolean (default: true) if false existing all images will be built even if one for group and tag exists
cb
function called back with error or an array of images that were built
- Source:
-
spinupTarstreams::runContainers(containers, opts, imageNames, cb)
-
Creates and starts containers for the given images according to the options.
Parameters:
Name Type Description containers
Object instance of initialized
{Containers}
opts
Object options that describe how each container is created and started
Properties
Name Type Argument Description exposePort
Object port to expose from the running docker process, the needed port bindings are set up as well
hostPortStart
Object <optional>
each docker container binds the exposed port to a host port starting at this port
removeExisting
Object <optional>
(default:
true
) iftrue
all existing containers for the groups the images belong to are stopped and removed before new ones are createdcreate
Object container creation options passed to dockerode
start
Object container start options passed to dockerode's
container.start
imageNames
Array.<string> names of all images, in form
'group:tag'
that were added to docker before for which to run a containercb
function called back when all containers were created or with an error if it failed
- Source:
-
spinupTarstreams::runGroup(images, containers, group, containerOpts, cb)
-
Starts up a container for each image of the given group that is found.
Parameters:
Name Type Argument Description images
Object instance of initialized
{Images}
containers
Object instance of initialized
{Containers}
group
string group of images for which to start containers
containerOpts
Object <optional>
options that describe how each container is created and started (@see spinupTarstreams::runContainers)
cb
function when finished, calls back with all currently running containers for the group or with an error
- Source:
-
spinupTarstreams::runImages(containers, imagesToRun, containerOpts, cb)
-
Starts up a container for each given image.
Parameters:
Name Type Argument Description containers
Object instance of initialized
{dockops.Containers}
imagesToRun
Array.<string> names of images to run of the form
'group:tag'
containerOpts
Object <optional>
options that describe how each container is created and started (@see spinupTarstreams::runContainers)
cb
function called back when all containers for the images were started or with an error
generated with docme
License
MIT