Skip to content
Snippets Groups Projects
Commit 4d9ebb22 authored by Jukka Veijanen's avatar Jukka Veijanen
Browse files

npm audit fix, reports in json and html format work

parent a17be5e7
No related branches found
No related tags found
1 merge request!18npm audit fix, reports in json and html format work
......@@ -14,14 +14,24 @@ WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
#COPY package*.json ./
# Bundle app source
COPY . .
# Install tool to report vulnerabilities in html format
RUN npm install -P npm-audit-html
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
# Create folder for audit reports
RUN mkdir reports
# Check vulnerabilities, fix, and check again and save result into html file
RUN sh audit-json-html.sh reports/audit-backend-prefix
RUN npm audit fix
RUN sh audit-json-html.sh reports/audit-backend-postfix
# 3000 can be found from source code app.js line 82.
EXPOSE 3000
......
#!/bin/bash
npm audit --json | node_modules/npm-audit-html/index.js --output audit-report.html
NOW=$(date '+%Y-%m-%d_%H.%M.%S')
FILE="$1"
if [ -z "$FILE" ]
then
FILE="audit-backend-report-$NOW"
fi
echo "Run audit to file $FILE{json|html}"
npm audit --json > $FILE.json
npm audit --json | node_modules/npm-audit-html/index.js --output $FILE.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment