5

I have 6 git sub-modules each with their own Dockerfile. I've setup my docker-compose.yml in this format:

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

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

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

A couple of my Dockerfiles have a step for bower to install the dependencies, but when this happens it errors out with the following message:

bower open-sans#~1.1.0 resolve git://github.com/bungeshea/open-sans.git#~1.1.0 bower foundation#~5.5.1 ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/zurb/bower-foundation.git", exit code of #128 fatal: Not a git repository: ../.git/modules/C

Additional error details: fatal: Not a git repository: ../.git/modules/C Service 'web' failed to build: The command '/bin/sh -c npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build' returned a non-zero code: 1

joslinm
  • 7,845
  • 6
  • 49
  • 72
  • Seems that the command: '/bin/sh -c npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build' should be replaced with: '/bin/sh -c "npm install && npm install -g bower && bower install --allow-root && npm install -g gulp && gulp build"' – yorammi Dec 31 '15 at 12:53
  • See https://github.com/bower/bower/pull/1106 – joslinm Dec 31 '15 at 17:44

2 Answers2

2

I had the same issue when using bower inside a Docker container, which was composed with docker-compose. This workaround did it for me (although this is not really satisfying):

GIT_DIR=/tmp bower install --allow-root

This pull request should fix it, but has not been merged yet.

n2o
  • 6,175
  • 3
  • 28
  • 46
  • @n20 - think I got it. Thanks for the tip! – jdixon04 Aug 13 '16 at 18:48
  • It manually sets the tempory directory which git should use. Seems like this does not work out-of-the-box within a docker container. GIT_DIR sets the environment variable just for this command. – n2o Aug 13 '16 at 21:53
1

Don't know if you've tried this already but try running the following command:

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

If this don't work you could try to configure the proxy/ports in the .bowerrc file.

Found some references here and here

Community
  • 1
  • 1
Mateus Cerqueira
  • 457
  • 4
  • 13