如何使用Docker在Heroku Review App中的PATH上获取GIT?

时间:2018-12-31 22:43:42

标签: git docker heroku dockerfile

最近我使用Docker的Heroku评论应用停止了构建。它们以前的行为符合预期,但现在看来npm在PATH上找不到git。

我的第一个猜测是由于某种原因,我现在需要在git-alpine中安装git。请参阅下面的尝试,其中添加了“ RUN npm install --no-cache git”

任何帮助将不胜感激!我也非常想知道为什么它表现出预期。

Dockerfile-heroku

FROM node:carbon-alpine

WORKDIR /usr/app
COPY . .

# Build Angular
RUN npm install --no-cache git
RUN npm install
RUN npm run build

WORKDIR ./server

# Build Webserver
RUN npm install
RUN npm run build

CMD ["node", "./bin/www"]

错误消息

Step 4/9 : RUN npm install
 ---> Running in f8800495a4ab
npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR! 
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR! 
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-28T13_15_27_080Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1

1 个答案:

答案 0 :(得分:1)

使用自定义nodejs/docker-node图像是: