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.4.8 to 1.4.9

3

index.js
'use strict';
var path = require('path');
var EOL = require('os').EOL;

@@ -67,3 +68,3 @@ var instructionsRegex = /^(CMD|FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)(\s*)/i;

var linesArr = dockerfile.split('\n');
var linesArr = dockerfile.split(EOL);

@@ -70,0 +71,0 @@ function validateLine(line) {

{
"name": "validate-dockerfile",
"version": "1.4.8",
"version": "1.4.9",
"description": "Validates a Dockerfile",

@@ -5,0 +5,0 @@ "main": "index.js",

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

var exec = require('child_process').exec;
var EOL = require('os').EOL;

@@ -14,3 +15,3 @@ describe('docklint', function () {

stdout.should.eql('Dockerfile looks good!\n');
stdout.should.eql('Dockerfile looks good!' + EOL);
stderr.should.eql('');

@@ -26,3 +27,3 @@ done();

stdout.should.eql('Dockerfile looks good!\n');
stdout.should.eql('Dockerfile looks good!' + EOL);
stderr.should.eql('');

@@ -37,3 +38,3 @@ done();

stdout.should.eql('');
stderr.should.eql(['VALIDATION FAILED',
stderr.should.eql(['VALIDATION FAILED',
'Missing or misplaced FROM',

@@ -44,3 +45,3 @@ 'at line 1',

'Missing CMD',
''].join('\n'));
''].join(EOL));
err.code.should.eql(1);

@@ -55,3 +56,3 @@ done();

stdout.should.eql('');
stderr.should.eql('ERROR: Dockerfile not found\n');
stderr.should.eql('ERROR: Dockerfile not found' + EOL);
err.code.should.eql(1);

@@ -58,0 +59,0 @@ done();

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

var validateDockerfile = require('../');
var EOL = require('os').EOL;

@@ -14,3 +15,3 @@ function expectsSuccess (line) {

line,
'CMD ["destroy", "Yavin IV"]'].join('\n');
'CMD ["destroy", "Yavin IV"]'].join(EOL);

@@ -30,3 +31,3 @@ var result = validateDockerfile(dockerfile);

line,
'CMD ["destroy", "Yavin IV"]'].join('\n');
'CMD ["destroy", "Yavin IV"]'].join(EOL);

@@ -50,3 +51,3 @@ var result = validateDockerfile(dockerfile);

it('should allow versions', function () {
var dockerfile = 'FROM vader/deathstar:2\nCMD ["destroy", "Yavin IV"]';
var dockerfile = 'FROM vader/deathstar:2' + EOL + 'CMD ["destroy", "Yavin IV"]';

@@ -62,3 +63,3 @@ var result = validateDockerfile(dockerfile);

it('Should allow underscores', function() {
var dockerfile = 'FROM vader/death_star:2\nCMD ["destroy", "Yavin IV"]';
var dockerfile = 'FROM vader/death_star:2' + EOL + 'CMD ["destroy", "Yavin IV"]';

@@ -74,3 +75,3 @@ var result = validateDockerfile(dockerfile);

it('Should reject with capital letters', function () {
var dockerfile = 'FROM Vader/Death-Star\nCMD ["destroy", "Yavin IV"]';
var dockerfile = 'FROM Vader/Death-Star' + EOL + 'CMD ["destroy", "Yavin IV"]';

@@ -107,7 +108,7 @@ var result = validateDockerfile(dockerfile);

it('should allow escaped newlines', expectsSuccess(
'RUN echo "A long time ago"\\\necho "In a galaxy far, far away"'
'RUN echo "A long time ago"\\' + EOL + 'echo "In a galaxy far, far away"'
));
it('should allow multiple escaped newlines', expectsSuccess(
'RUN echo "It is a period of civil war. Rebel"\\\necho "spaceships, striking from a hidden"\\\necho "base, have won their first victory"\\\necho "against the evil Galactic Empire."'
'RUN echo "It is a period of civil war. Rebel"\\' + EOL + 'echo "spaceships, striking from a hidden"\\' + EOL + 'echo "base, have won their first victory"\\' + EOL + 'echo "against the evil Galactic Empire."'
));

@@ -114,0 +115,0 @@ });

@@ -9,3 +9,4 @@ 'use strict';

, path = require('path')
, callbackCount = require('callback-count');
, callbackCount = require('callback-count')
, EOL = require('os').EOL;

@@ -35,3 +36,3 @@ // dockerfiles tested here from https://github.com/kstaken/dockerfile-examples/tree/master/salt-minion

it('should complain about an invalid instruction', function () {
var dockerfile = 'FROM vader/force-powers\nCONJURE stolen_data_tapes';
var dockerfile = 'FROM vader/force-powers' + EOL + 'CONJURE stolen_data_tapes';

@@ -104,3 +105,3 @@ var result = validateDockerfile(dockerfile);

'CMD heal paitent'
].join('\n');
].join(EOL);

@@ -123,3 +124,3 @@ var result = validateDockerfile(dockerfile);

'CMD heal paitent'
].join('\n');
].join(EOL);

@@ -155,3 +156,3 @@ var result = validateDockerfile(dockerfile);

it('rejects a dockerfile with only comments', function () {
var dockerfile = '#Witness the power of this\n#Fully documented battlestation';
var dockerfile = '#Witness the power of this' + EOL + '#Fully documented battlestation';

@@ -172,3 +173,3 @@ var result = validateDockerfile(dockerfile);

it('rejects a dockerfile with only newlines', function () {
var dockerfile = '\n\n\n\n\n';
var dockerfile = EOL + EOL + EOL + EOL + EOL;

@@ -175,0 +176,0 @@ var result = validateDockerfile(dockerfile);

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