# @pubcore/node-docker-build

> Scripts to build and deploy pubcore compositions

Latest version **3.7.1** (published 2020-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pubcore/node-docker-build
pnpm add @pubcore/node-docker-build
yarn add @pubcore/node-docker-build
bun add @pubcore/node-docker-build
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.7.1 |
| Published | 2020-11-12 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pubcore |
| Maintainers | fidorw, dominix, jacklrs |

## Links

- npm: https://www.npmjs.com/package/@pubcore/node-docker-build
- Repository: https://github.com/pubcore/node-docker-build
- Homepage: https://github.com/pubcore/node-docker-build#readme
- Issues: https://github.com/pubcore/node-docker-build/issues
- npm.io page: https://npm.io/package/@pubcore/node-docker-build

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^4.2.0
- [pacote](https://npm.io/package/pacote.md) ^11.1.13
- [await-spawn](https://npm.io/package/await-spawn.md) ^4.0.1
- [git-url-parse](https://npm.io/package/git-url-parse.md) ^11.4.0
- [promise-retry](https://npm.io/package/promise-retry.md) ^2.0.1

## Recent versions

- 3.7.1 (latest) — 2020-11-12
- 3.7.0 — 2020-11-08
- 3.6.4 — 2020-09-28
- 3.6.3 — 2020-09-28
- 3.6.2 — 2020-09-22
- 3.6.1 — 2020-09-22
- 3.6.0 — 2020-09-22
- 3.5.3 — 2020-03-20
- 3.5.2 — 2020-02-27
- 3.5.1 — 2020-02-27
- 3.5.0 — 2020-02-19
- 3.4.2 — 2020-02-12
- 3.4.1 — 2019-11-30
- 3.3.0 — 2019-11-28
- 3.2.1 — 2019-11-27
- … 63 more at https://npm.io/package/@pubcore/node-docker-build/versions

## README

## functions to build and deploy to a docker swarm, based on configuration

#### Prerequisites
* latest docker installed (deamon is running and docker-compose does work)
* latest nodejs/npm installed
* git client installed
* ssh access (optional over jump host) to deployment target, docker manager host

#### Configuration example: domain-config module (config.js)
```
'use strict'

module.exports = {
	baseImage:'node:10.15.1-alpine'
	compositions:['test'], //compostions of subdomains e.g. test.example.com
	target:{ //optional, target system (deploy)
		host:{host:'manager.example.com', key:'/home/admin/.ssh/id_rsa', user:'admin'},
		jump:{host:'connect.example.com', key:'~/.ssh/id_rsa', user:'admin'},
		home:'/home/admin',
		stackName: 'example',
		sudo:false //optional, prepend "sudo", if required for docker commands
	},
	configs:{ //optional, will be transfered to create docker config (deploy)
		'verdaccio-conf-v2':'verdaccio/conf/config.yaml'
	},
	detach: true //optional, if false std-out/-err is piped to current shell,
	push: true //optional, if false no docker-compose push will be executed,
	update: false //optional, if true "npm update" is used, else "npm install",
	forcePull: false //optional, if true --pull flag is set for docker build,
	buildKit: false //optional, if true docker build kit is enabled for build,
	retryOptions: {retries:1, minTimeout:30000} //retry options for updatePackages
}
```

#### Examples
1) In context of an CI/CD server:
Build, push and deploy some images on a dev system composition (dev.example.com)
Execution is done in background (spawn a script).
If there is already running one, it will be killed.
Output is piped to file within defined "logPath".
```
import {buildDeploy} from '@pubcore/node-docker-build'

buildDeploy({
	repo:'git@github.com:your-scope/compositions.git',
	domain:'dev.example.com',
	logPath:'~/'
})
```

In context of local compositions package, on developers machine:
Build and push some images of a domain.
Execution runns in foreground (detach=false), stdout to console
```
const {build} = require('@pubcore/node-docker-build')
build({
	configModule: resolve(__dirname, 'domains', 'host.docker.internal' , 'config'),
	detach: false,
})
```

---
_Source: https://npm.io/package/@pubcore/node-docker-build · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
