从私人gilab存储库中提取的Docker容器

时间:2017-12-11 08:58:59

标签: node.js docker

我正在为我的Node.js + Vue应用程序构建一个Docker容器。

由于我在另一个存储库中有一个全局css库,我在package.json文件中添加了这一行:

"lib-css": "git+ssh://git@git.lib.com:9922/username/lib-css.git#development",

当我运行npm install时,我也安装了我的CSS库。问题是在我的本地环境上它要求我的密码,我可以插入它,但在Docker构建过程中失败,出现以下错误:

Step 7/10 : RUN npm install
 ---> Running in db10ca83586d
npm WARN deprecated babel-preset-es2015@6.24.1:   Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@git.lib.com:9922/username/lib-css.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-12-11T08_49_11_152Z-debug.log

这是我目前的Dockerfile

FROM node:carbon

WORKDIR /usr/src/app

RUN mkdir -p /root/.ssh
COPY .secrets /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh && chmod 600 /root/.ssh/*

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

EXPOSE 8081
CMD [ "npm", "run dev" ]
~

我的.secrets文件包含与存储库关联的私钥。

我该如何使其有效?

0 个答案:

没有答案