Socket
Socket
Sign inDemoInstall

dockerode

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dockerode - npm Package Compare versions

Comparing version 3.3.3 to 3.3.4

71

lib/docker.js
var EventEmitter = require('events').EventEmitter,
Modem = require('docker-modem'),
tar = require('tar-fs'),
zlib = require('zlib'),
Container = require('./container'),

@@ -261,31 +259,36 @@ Image = require('./image'),

function build(file) {
var optsf = {
path: '/build?',
method: 'POST',
file: file,
options: opts,
abortSignal: opts && opts.abortSignal,
isStream: true,
statusCodes: {
200: true,
500: 'server error'
}
};
var optsf = {
path: '/build?',
method: 'POST',
file: undefined,
options: opts,
abortSignal: opts && opts.abortSignal,
isStream: true,
statusCodes: {
200: true,
500: 'server error'
}
};
if (opts) {
if (opts.registryconfig) {
optsf.registryconfig = optsf.options.registryconfig;
delete optsf.options.registryconfig;
}
if (opts) {
if (opts.registryconfig) {
optsf.registryconfig = optsf.options.registryconfig;
delete optsf.options.registryconfig;
}
//undocumented?
if (opts.authconfig) {
optsf.authconfig = optsf.options.authconfig;
delete optsf.options.authconfig;
}
//undocumented?
if (opts.authconfig) {
optsf.authconfig = optsf.options.authconfig;
delete optsf.options.authconfig;
}
}
if (callback === undefined) {
if (callback === undefined) {
const prepareCtxPromise = new self.modem.Promise(function(resolve, _) {
util.prepareBuildContext(file, resolve)
});
return prepareCtxPromise.then((ctx)=> {
return new self.modem.Promise(function(resolve, reject) {
optsf.file = ctx;
self.modem.dial(optsf, function(err, data) {

@@ -298,17 +301,11 @@ if (err) {

});
} else {
})
} else {
util.prepareBuildContext(file, (ctx) => {
optsf.file = ctx;
self.modem.dial(optsf, function(err, data) {
callback(err, data);
});
}
})
}
if (file && file.context) {
var pack = tar.pack(file.context, {
entries: file.src.slice()
});
return build(pack.pipe(zlib.createGzip()));
} else {
return build(file);
}
};

@@ -315,0 +312,0 @@

@@ -0,1 +1,7 @@

var DockerIgnore = require('@balena/dockerignore');
var fs = require('fs');
var path = require('path');
var tar = require('tar-fs');
var zlib = require('zlib');
// https://github.com/HenrikJoreteg/extend-object/blob/v0.1.0/extend-object.js

@@ -71,1 +77,31 @@

};
module.exports.prepareBuildContext = function(file, next) {
if (file && file.context) {
fs.readFile(path.join(file.context, '.dockerignore'), (err, data) => {
let ignoreFn;
let filterFn;
if (!err) {
const dockerIgnore = DockerIgnore({ ignorecase: false }).add(data.toString());
filterFn = dockerIgnore.createFilter();
ignoreFn = (path) => {
return !filterFn(path);
}
}
const entries = file.src.slice() || []
const pack = tar.pack(file.context, {
entries: filterFn ? entries.filter(filterFn) : entries,
ignore: ignoreFn // Only works on directories
});
next(pack.pipe(zlib.createGzip()));
})
} else {
next(file);
}
}
{
"name": "dockerode",
"description": "Docker Remote API module.",
"version": "3.3.3",
"version": "3.3.4",
"author": "Pedro Dias <petermdias@gmail.com>",

@@ -18,2 +18,3 @@ "maintainers": [

"dependencies": {
"@balena/dockerignore": "^1.0.2",
"docker-modem": "^3.0.0",

@@ -20,0 +21,0 @@ "tar-fs": "~2.0.1"

@@ -8,3 +8,3 @@ # dockerode

* **streams** - `dockerode` does NOT break any stream, it passes them to you allowing for some stream voodoo.
* **stream demux** - Supports optional demultiplexing.
* **stream demux** - Supports optional [stream demultiplexing](https://github.com/apocas/dockerode#helper-functions).
* **entities** - containers, images and execs are defined entities and not random static methods.

@@ -11,0 +11,0 @@ * **run** - `dockerode` allow you to seamless run commands in a container ala `docker run`.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc