
[英]How to create a Azure APP Service with a private Azure Container Registry?
[英]Authenticate to private npm registry from Dockerfile in azure?
我有以下 Dockerfile:
FROM node:alpine
WORKDIR ./usr/local/lib/node_modules/npm/
COPY .npmrc ./
COPY package.json ./
COPY package-lock.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start-prod"]
此文件在 azure 管道中使用,如下所示:
variables:
- name: NPMRC_LOCATION
value: $(Agent.TempDirectory)
- stage: BuildPublishDockerImage
displayName: Build and publish Docker image
dependsOn: Build
jobs:
- job: BuildPublishDockerImage
steps:
- checkout: self
- task: DownloadSecureFile@1
name: npmrc
inputs:
secureFile: .npmrc
- task: npmAuthenticate@0
inputs:
workingFile: $(NPMRC_LOCATION)/.npmrc
- task: Docker@2
displayName: Build a Docker image
inputs:
command: build
arguments: --no-cache
我知道.npmrc
應該在那個位置(我在 Dockerfile 和那里運行RUN ls
)。
但是,當我運行它時,我不斷收到此錯誤:
無法使用前端 dockerfile.v0 解決:構建 LLB 失敗:計算緩存鍵失敗:“/.npmrc”未找到:未找到
我只想對私有 npm 注冊表進行身份驗證。 我對此感到困惑。 感謝您的幫助。
你可以在Dockerfile設置注冊表
npm config set registry
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.