【问题标题】:Bower + Git submodules + Docker composeBower + Git 子模块 + Docker 组合
【发布时间】:2015-12-30 22:31:03
【问题描述】:

我有 6 个 git 子模块,每个子模块都有自己的 Dockerfile。我以这种格式设置了我的docker-compose.yml

a:
  build: A
  dockerfile: Dockerfile
  ports:
    - "9000:9000"

b:
  build: B
  dockerfile: Dockerfile
  ports:
    - "3000:3000"

c:
  build: C
  dockerfile: Dockerfile
  ports:
    - "3001:3001"

我的几个Dockerfiles 有一个让 bower 安装依赖项的步骤,但是当发生这种情况时,它会出错并显示以下消息:

bower open-sans#~1.1.0 解决 git://github.com/bungeshea/open-sans.git#~1.1.0 凉亭 基础#~5.5.1 ECMDERR 无法执行“git ls-remote --tags --heads git://github.com/zurb/bower-foundation.git",退出代码 #128 致命:不是 git 存储库:../.git/modules/C

其他错误详细信息:致命:不是 git 存储库: ../.git/modules/C Service 'web' 构建失败:命令 '/bin/sh -c npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build' 返回一个非零代码:1

【问题讨论】:

  • 似乎命令:'/bin/sh -c npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build' 应该替换为: '/bin/sh -c "npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build"'

标签: git docker bower docker-compose


【解决方案1】:

在使用 docker-compose 组成的 Docker 容器中使用 bower 时,我遇到了同样的问题。这个解决方法为我做了(虽然这并不令人满意):

GIT_DIR=/tmp bower install --allow-root

这个pull request 应该修复它,但尚未合并。

【讨论】:

  • @n20 - 我想我明白了。感谢您的提示!
  • 它手动设置 git 应该使用的临时目录。似乎这在 docker 容器中不能开箱即用。 GIT_DIR 只为这个命令设置环境变量。
【解决方案2】:

不知道您是否已经尝试过,但请尝试运行以下命令:

git config --global url."https://".insteadOf git://

如果这不起作用,您可以尝试在 .bowerrc 文件中配置代理/端口。

找到了一些参考herehere

【讨论】:

    猜你喜欢
    • 2019-06-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-27
    • 1970-01-01
    • 1970-01-01
    • 2010-12-04
    • 2015-04-24
    • 2014-09-30
    相关资源
    最近更新 更多