簡體   English   中英

從 Dockerfile 中的 BitBucket 安裝 node_modules

[英]Install node_modules from BitBucket in Dockerfile

我已經從 BitBucket 安裝了一個節點模塊。 這是我的 package.json

"dependencies": {
    "some-module": "git+https://bitbucket.org/some-module.git"
}

但是,當我使用此 Dockerfile 構建 Docker 映像時,

FROM node:14.4.0

WORKDIR /usr/src/app

COPY ./package*.json ./

RUN npm install

COPY ./ .

我無法構建,因為在構建映像時我沒有提供 git 憑據。

我不想將 git 憑據保存在 package.json 文件中,而是將其保存在服務器中。 什么類型的憑據以及如何在構建映像時提供憑據?

您可能希望為此使用 ssh 密鑰,而不是用戶憑據

更多細節在這里

As altready mentioned you can use ssh url in your Package.json and configure the SSH keys on the environment where your Dockerfile is built.

Otherwise, you can also use a private package repository, such as Artifactory or Nexus , publish your library package on this repo, then install it via npm, configure npm to use your private repository instead of npm public.

https://blog.sonatype.com/using-nexus-3-as-your-repository-part-2-npm-packages

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM