Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using private svn+bower doesn't work in dockerfile

Tags:

docker

bower

svn

I've been trying to use docker to run my development environment. My stack have a private bower registry that needs a .bowerrc in my $HOME.

The format of my .bowerrc file it's:

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

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

The way of I mount this file in my docker file was using 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 have been built for support a environment that use bower, gulp and svn. This is the 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 that use bower install command is 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)

Anybody can help me to understand this?

like image 577
Gonzalo Pincheira Arancibia Avatar asked Oct 19 '22 00:10

Gonzalo Pincheira Arancibia


1 Answers

Finally I understand the problem.

The SVN certificate should be accepted inside the docker container. For to do this, inside the docker container, entering using the interactive-attach mode -ia and using a entry point the /bin/bash console, I ran this 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 all works fine!

like image 182
Gonzalo Pincheira Arancibia Avatar answered Oct 21 '22 05:10

Gonzalo Pincheira Arancibia