Skip to content

Commit

Permalink
fix: hadolint demands yarn cache clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Forattini committed Apr 28, 2022
1 parent 6119517 commit ed8736e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/scrappers/nodejs.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ module.exports = class Nodejs extends Scrapper {
? 'package-lock.json'
: 'package.json'

const completeDependencyCommand = [
dependencyCommand,
hasYarnLock ? 'yarn cache clean' : '',
].join('\\\n\t')

this
.add('code', {
cacheKey,
Expand All @@ -43,7 +48,7 @@ module.exports = class Nodejs extends Scrapper {
entrypoint,
command,
dockerignore,
dependencyCommand,
dependencyCommand: completeDependencyCommand,
})
}
}
6 changes: 2 additions & 4 deletions src/steps/generate-dockerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const Template = require("../template");
const stub = `
# This file was autogenerated at {{generatedAt}}.
FROM {{image}}:{{tag}}
MAINTAINER {{maintainer}}
LABEL {{labels}}
ENV {{environemntVariables}}
WORKDIR /app
Expand All @@ -25,7 +25,6 @@ module.exports = function (params, writeFile = true) {
const {
image,
tag,
maintainer,
labels = [],
environemntVariables = [ 'TZ=GMT', 'ENV=development' ],
generatedAt = new Date().toISOString(),
Expand All @@ -40,9 +39,8 @@ module.exports = function (params, writeFile = true) {
generatedAt,
image,
tag,
maintainer,
labels: [
`builtAt=${new Date().toISOString().substring(0, 10)}`,
`built-at=${new Date().toISOString().substring(0, 10)}`,
].concat(labels).join(' \\\n\t'),
environemntVariables: [].concat(environemntVariables).join(' \\\n\t'),
dependencyCommand,
Expand Down

0 comments on commit ed8736e

Please sign in to comment.