【发布时间】:2021-09-16 12:13:26
【问题描述】:
我有一个如下的 dockerfile,但是在RUN npm ci 步骤中,有一个警告,
npm WARN old lockfile package-lock.json 文件是用旧版本的 npm 创建的
我想不通..
我尝试使用 npm install 而不是 npm ci 并添加了 --package-lock 标志,但我仍然收到此警告。这是一种警告。我必须忽略它还是应该怎么做才能解决这个问题?
Step 12/26 : RUN npm ci --production --package-lock && npm ci --production --package-lock --prefix ./ui-runner
---> Running in 3473c209b98c
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
这是我的 Dockerfile。
FROM node:14.17.1-alpine3.13 AS builder
WORKDIR /usr/src/app
COPY package.json package-lock.json* ./
COPY ui-runner/package*.json ./ui-runner/
COPY .npmrc .npmrc
COPY ui-runner/.npmrc ./ui-runner/.npmrc
RUN npm -g install npm@7.19.1
RUN npm ci --production --package-lock && \
npm ci --production --package-lock --prefix ./ui-runner
RUN rm -f .npmrc && \
rm -f ui-runner/.npmrc
FROM node:14.17.1-alpine3.13
WORKDIR /usr/src/app
RUN apk update && apk add --no-cache curl bash
RUN addgroup -g 1001 test && \
adduser -S -u 1001 -G test test
RUN chown -R test /usr/src/app && \
chmod 755 /usr/src/app
COPY --from=builder /usr/src/app /usr/src/app
COPY . .
RUN npm run build:docker
USER test
EXPOSE 3000 9183
CMD [ "npm", "run", "start:ui-runner" ]
【问题讨论】:
标签: node.js docker npm dockerfile