4.12.2 • Published 3 years ago

resin-multibuild v4.12.2

Weekly downloads
639
License
Apache-2.0
Repository
github
Last release
3 years ago

resin-multibuild

This module is designed to make it easy to build a composition given a representation of this composition, and a tar stream. The output will be several images present on the given docker daemon.

API

splitBuildStream

function splitBuildStream(composition: Composition, buildStream: ReadableStream): Promise<BuildTask[]>

Given a Composition which conforms to the type from resin-compose-parse and a stream which will produce a tar archive, split this tar archive into a set of build tasks which can then be further processed.

function performResolution(
	tasks: BuildTask[],
	architecture: string,
	deviceType: string
): Promise<BuildTask[]>

Given a list of build tasks, resolve the projects to a form which the docker daemon can build. Currently this function supports all project types which resin-bundle-resole supports.

Note that this function will also populate the dockerfile and projectType values in the build tasks.

function performBuilds(
	tasks: BuildTask[],
	docker: Dockerode
): Promise<LocalImage[]>

Given a list of build tasks, perform the task necessary for the LocalImage to be produced. A local image represents an image present on the docker daemon given.

Note that one should assign a stream handling function for build output OR a progress handling function for image pull output before calling this function. The fields for these functions are streamHook and progressHook.

Example (pseudocode)

import * as Promise from 'bluebird';

import { Composition, normalize } from 'resin-compose-parse';
import { splitBuildStream, performBuilds } from 'resin-multibuild';


// Get a tar stream and composition from somewhere
const stream = getBuildStream();
const composeFile = getComposeFile();
const docker = getDockerodeHandle();

// Parse the compose file
const comp = normalize(composeFile);

splitBuildStream(comp, stream)
.then((tasks) => {
	return performResolution(tasks, 'armv7hf', 'raspberrypi3');
})
.map((task) => {
	if (task.external) {
		task.progressHook = (progress) => {
			console.log(task.serviceName + ': ' + progress);
		};
	} else {
		task.streamHook = (stream) => {
			stream.on('data', (data) => {
				console.log(task.serviceName + ': ', data.toString());
			});
		};
	}
	return task;
})
.then((tasks) => {
	return performBuilds(builds, docker);
})
.then((images) => {
	// Do something with your images
});
4.12.2

3 years ago

4.12.0

3 years ago

4.12.1

3 years ago

4.11.1

3 years ago

4.10.1

3 years ago

4.11.0

3 years ago

4.10.0

4 years ago

4.9.1

4 years ago

4.9.0

4 years ago

4.8.0

4 years ago

4.7.3

4 years ago

4.7.2

4 years ago

4.7.1

4 years ago

4.7.0

4 years ago

4.6.1

4 years ago

4.6.2

4 years ago

4.6.0

4 years ago

4.5.1

4 years ago

4.5.0

4 years ago

4.4.2

4 years ago

4.4.1

4 years ago

4.4.0

4 years ago

4.3.4

4 years ago

4.3.3

4 years ago

4.3.2

5 years ago

4.3.1

5 years ago

4.3.0

5 years ago

4.2.2

5 years ago

4.2.1

5 years ago

4.2.0

5 years ago

4.1.0

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago