我正在尝试在 Azure Pipeline 中构建 Docker 映像。在本地一切都像黄油一样运行,在 Azure 上我得到
/bin/sh: 1: cannot create .npmrc: Permission denied
使用以下 Dockerfile:
# Build stage
FROM node:14-slim AS Build
# Pass build arguments. Sensitive information allowed
# This information is not available anymore in next build stage
ARG NPM_TOKEN
# Create app directory
USER node
WORKDIR /home/node/app
# Install app dependencies first
COPY --chown=node:node package*.json ./
# If you are building your code for production
RUN npm ci --only=production
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc && \
npm ci --only=production && \
rm -f .npmrc
[...]
我有点困惑:
答案 0 :(得分:0)
好的,找到了。 home/node/app 不属于节点用户...