Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-dockerfile

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-dockerfile - npm Package Compare versions

Comparing version 1.5.0 to 1.5.2

.travis.yml

7

index.js

@@ -13,3 +13,3 @@ 'use strict';

var paramsRegexes = {
from: /^[a-z0-9.\/_-]+(:[a-z0-9.]+)?$/,
from: /^[a-z0-9.\/_-]+(:[a-z0-9._-]+)?$/,
maintainer: /.+/,

@@ -88,2 +88,5 @@ expose: /^[0-9]+([0-9\s]+)?$/,

// Whitespace on the ends will not break Dockerfile (see #13)
line = line.trim();
// First instruction must be FROM

@@ -145,2 +148,2 @@ if (!fromCheck) {

module.exports = validate;
module.exports = validate;
{
"name": "validate-dockerfile",
"version": "1.5.0",
"version": "1.5.2",
"description": "Validates a Dockerfile",

@@ -31,4 +31,6 @@ "main": "index.js",

"find": "^0.1.7",
"istanbul": "^0.3.4",
"mocha": "^2.0.1",
"should": "^4.0.4"
}
}

@@ -5,2 +5,7 @@ #validate-dockerfile

[![Build Status](https://travis-ci.org/Runnable/validate-dockerfile.svg?branch=master)](https://travis-ci.org/Runnable/validate-dockerfile)
[![Dependency Status](https://david-dm.org/runnable/validate-dockerfile.svg)](https://david-dm.org/runnable/validate-dockerfile)
[![devDependency Status](https://david-dm.org/runnable/validate-dockerfile/dev-status.svg)](https://david-dm.org/runnable/validate-dockerfile#info=devDependencies)
[![NPM](https://nodei.co/npm/validate-dockerfile.png?downloads=true&downloadRank=true&stars=true)](https://npmjs.org/package/validate-dockerfile)
##Installation

@@ -67,2 +72,2 @@

Examples used in testing borrowed from https://github.com/kstaken/dockerfile-examples/tree/master/salt-minion. Thanks!
Examples used in testing borrowed from https://github.com/kstaken/dockerfile-examples/tree/master/salt-minion. Thanks!

@@ -10,3 +10,3 @@ 'use strict';

it('should allow a valid Dockerfile', function (done) {
exec('./bin/docklint ./test/Dockerfiles/dockerfile-0',
exec('./bin/docklint ./test/Dockerfiles/Dockerfile-0',
function (err, stdout, stderr) {

@@ -22,3 +22,3 @@ if (err) { return done(err); }

it.skip('should allow a valid Dockerfile in the same dir', function (done) {
exec('./bin/docklint ./test/Dockerfiles/dockerfile-0',
exec('./bin/docklint ./test/Dockerfiles/Dockerfile-0',
function (err, stdout, stderr) {

@@ -34,3 +34,3 @@ if (err) { return done(err); }

it('should fail an invalid Dockerfile', function (done) {
exec('./bin/docklint ./test/Dockerfiles/dockerfile-bad',
exec('./bin/docklint ./test/Dockerfiles/Dockerfile-bad',
function (err, stdout, stderr) {

@@ -59,2 +59,2 @@ stdout.should.eql('');

});
});
});

@@ -10,2 +10,9 @@ 'use strict';

function shouldBeValid (result) {
result.should.be.an.Object;
result.should.have.property('valid', true);
result.should.not.have.property('message');
result.should.not.have.property('line');
}
function expectsSuccess (line) {

@@ -19,6 +26,3 @@ return function () {

result.should.be.an.Object;
result.should.have.property('valid', true);
result.should.not.have.property('message');
result.should.not.have.property('line');
shouldBeValid(result);
};

@@ -54,6 +58,3 @@ }

result.should.be.an.Object;
result.should.have.property('valid', true);
result.should.not.have.property('message');
result.should.not.have.property('line');
shouldBeValid(result);
});

@@ -66,2 +67,18 @@

shouldBeValid(result);
});
it('Should allow dashes in the tag', function() {
var dockerfile = 'FROM vader/death_star:2-dev' + EOL + 'CMD ["destroy", "Yavin IV"]';
var result = validateDockerfile(dockerfile);
shouldBeValid(result);
});
it('Should allow dashes', function() {
var dockerfile = 'FROM vader/death-star:2' + EOL + 'CMD ["destroy", "Yavin IV"]';
var result = validateDockerfile(dockerfile);
result.should.be.an.Object;

@@ -73,2 +90,18 @@ result.should.have.property('valid', true);

it('Should allow multiple slashes', function() {
var dockerfile = 'FROM vader/death_star/hangar/tie' + EOL + 'CMD ["destroy", "X-Wing"]';
var result = validateDockerfile(dockerfile);
shouldBeValid(result);
});
it('Should allow registry url', function() {
var dockerfile = 'FROM thyferra.io/bacta/canister' + EOL + 'CMD ["heal", "Skywalker"]';
var result = validateDockerfile(dockerfile);
shouldBeValid(result);
});
it('Should reject with capital letters', function () {

@@ -75,0 +108,0 @@ var dockerfile = 'FROM Vader/Death-Star' + EOL + 'CMD ["destroy", "Yavin IV"]';

@@ -18,3 +18,2 @@ 'use strict';

counter.inc();
fs.readFile(file, 'UTF-8', function (err, data) {

@@ -21,0 +20,0 @@ if (err) {

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