Я играю с Docker, чтобы создать образ приложения для небольшого узла, и я хотел бы избавиться от предупреждения ниже:
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN webserver@1.0.0 No description
npm WARN webserver@1.0.0 No repository field.
при создании моего изображения
PS C:\Users\eperret\Desktop\webserver> docker build .
Sending build context to Docker daemon 4.096kB
Step 1/5 : FROM node:alpine
---> cd4fae427afc
Step 2/5 : COPY ./package.json ./
---> 990e1ee0398d
Step 3/5 : RUN npm install
---> Running in 8ffb61d273e4
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN webserver@1.0.0 No description
npm WARN webserver@1.0.0 No repository field.
added 48 packages from 36 contributors and audited 121 packages in 1.675s
found 0 vulnerabilities
Removing intermediate container 8ffb61d273e4
---> fff34a1d0b4e
Step 4/5 : COPY ./ ./
---> ace2bc83a3f9
Step 5/5 : CMD [ "npm", "start" ]
---> Running in fa9d0a961867
Removing intermediate container fa9d0a961867
---> 34a593a4b338
Successfully built 34a593a4b338
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Мой Dockerfile
FROM node:alpine
COPY ./package.json ./
RUN npm install
COPY ./ ./
CMD [ "npm", "start" ]
//Load express module with `require` directive
var express = require('express')
var app = express()
//Define request response in root URL (/)
app.get('/', (req, res) => {
res.send('How are you doing');
});
//Launch listening server on port 8081
app.listen(8080, () => {
console.log('Listening on port 8080');
});
и package.json
:
{
"name": "webserver",
"version": "1.0.0",
"description": "",
"repository": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "*"
}
}
Мне также кажется странным, что есть также предупреждение об отсутствии полей description
и repository
, поскольку оба они присутствуют в моем package.json
выше.