Private gems in gemfile

So we have started setting up quite a few engines and normal rails gems that are private repos. Because these are private repositories, I knew it was going to be a different setup

It's pretty easy to setup.

The Gemfile stays the same, reference the git repo as usual.

gem 'frefnet', git: ""

If you run bundle install with this, you will receive an error because its a private repo.

To fix this we need to add an oauth key to the bundler config.

Generate a personal outh key from your github account, with private repo access

Add it to your config with, and thats it!

bundle config <GITHUB-USERNAME>:93921321939MYAUTHTOKEN2131231

Docker Setup

I needed to also set this up on our CI for our production boxes.

I had to change

These are the changes I made:

  1. Added an ARG github_token inside the Dockerfile. This allows me to pass in a github token when building the dockerfile
  2. Changed the usual bundle install line in the Dockerfile to: ruby RUN bundle config deploywebbernet:$github_token && (bundle install --without test development) && bundle config --delete This does a bundle install with the token, and then removes the token so it doesn't sit in the Container.
  3. In the CI build service, I added a --build-arg flag to the docker build command. ruby docker build -f ci-Dockerfile-Chromium --build-arg github_token=$PRIVATE_GEM_GITHUB_TOKEN -t tester .