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

标签 git docker heroku dockerfile

最近,我使用Docker的Heroku Review Apps停止了构建。它们以前的行为符合预期,但是现在看来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

最佳答案

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

  • based on alpine
  • 确实将Git添加为shown in PR 367(这尚未集成到官方镜像中,因此您现在必须定义自己的)
  • 关于git - 如何使用Docker在Heroku Review App中的PATH上获取GIT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53991935/

    相关文章:

    git - Android Studio-.iml文件更改名称

    git - 将 git 存储库移动到 nfs 会导致权限错误

    git - 为什么在 Visual Studio Code 中执行 git pull 后我有未提交的更改?

    heroku 提示我的公钥由 ssh-keygen2 创建

    node.js - heroku 上缺少 Access-Control-Allow-Origin header

    git - 无法运行解析仪表板

    Azure 应用服务中的 MongoDB,通过 Docker-Compose

    mysql - 在 Jenkins 中使用 docker exec 运行 October artisan 命令时连接被拒绝

    Windows Server 2016 Docker 镜像支持 SQL Server?

    html - 在页面之间切换时整个页面闪烁白色