Using private svn + bower does not work in dockerfile

I am trying to use docker to run a development environment. There is a private registry in my stack for bower that requires .bowerrc in my $HOME .

The format of my .bowerrc file is:

/home/.bowerrc (inside my docker set as volume)

 { "registry": "https://<user>:<password>@bower.mycompany.com", "timeout": 300000, "strict-ssl": false } 

The way to mount this file in my docker file used this command:

 docker run -it --net='host' -v $(pwd):/home/dev/app -v /home/USER/.dockershared/.bowerrc:/home/.bowerrc --name="myproject" --privileged bower-gulp:node0.12 

My Dockerfile was created to support an environment using gazebo, gulp and svn. This is Dockerfile

 FROM node:0.12-wheezy RUN useradd -ms /bin/bash dev RUN chown -R dev:dev /home/dev USER dev ENV HOME /home/dev ENV PATH "$PATH:/home/dev/.npm-global/bin" WORKDIR /home/dev/app RUN mkdir /home/dev/.npm-global && \ npm config set prefix '/home/dev/.npm-global' && \ npm install -g bower gulp && \ apt-get install subversion ENTRYPOINT ["/bin/sh", "-c", "/bin/bash"] 

My package.json file with the bower install command looks like this:

 { "name": "my_project", "version": "3.1.3", "description": "", "author": "", "license": "ISC", "repository": { "type": "svn", "url": "https://svn.mycompany.com/repos/My_repo" }, "devDependencies": { "bower": "1.x", "del": "^2.2.0", "gulp": "3.x", "gulp-maven-deploy": "^0.2.0", "gulp-rename": "^1.2.2", "gulp-template": "^3.1.0", "node-rest-client": "^1.8.0", "run-sequence": "^1.1.5", "svn-npm-crutch": "0.x" }, "svnDependencies": { "framework-tools-build": "https://svn.mycompany.com/repos/tools/build/trunk", "framework-tools-functional-testing": "https://svn.mycompany.com/repos/tools/functional-testing/trunk" }, "engines": { "node": ">=0.8.0" }, "scripts": { "install": "bower install -F --allow-root && node ./node_modules/svn-npm-crutch/lib/svn-npm-crutch.js", "demo-mode": "gulp functional-test --browser=chrome --demo" }, "config": { "unsafe-perm": true } } 

Finally, when I try npm install or bower install , I get this error:

 bower ECMDERR Failed to execute "svn list https://svn.mycompany.com/repos/ui/common/tags --verbose --non-interactive", exit code of #1 svn: OPTIONS of 'https://svn.mycompany.com/repos/ui/common/tags': authorization failed: Could not authenticate to server: rejected Basic challenge (https://svn.mycompany.com) Additional error details: svn: OPTIONS of 'https://svn.mycompany.com/repos/ui/common/tags': authorization failed: Could not authenticate to server: rejected Basic challenge (https://svn.mycompany.com) 

Can anyone help me figure this out?

+5
source share
2 answers

Finally, I understand the problem.

The SVN certificate must be accepted inside the docker container. To do this, inside the docker container entering interactive -ia mode and using the entry point in the console /bin/bash , I executed the following command:

svn info <any_svn_respository_of_my_company>

Example

svn info https://svn.mycompany.com/repos/ui/common/ .

Then I accepted the certificate and everything works fine!

+2
source

This may be due to the difference in user IDs between your docker and the host machine. Thus, this leads to the fact that the docker cannot read the files necessary for entry.

To find out your user ID (UID), run a host and docker run: id -u $USER

If they are different from each other, I would reconstruct the image and create the user inside the docker image as follows: useradd -u 999 USERNAME , where 999 must be a user UID that owns your credentials from your host computer, the username may be different.

Hope that solves your problem, Regards!

0
source

Source: https://habr.com/ru/post/1258216/


All Articles