繁体   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