GitGud, GitHub clone entirely written in Elixir

@MarioFlach impressive !

I’ve got a question. When building Erlang/Elixir software in docker - private repositories (git ssh) are always a problem. The current options are:

  1. (Linux only, doesn’t work on Mac) - Dockerfile which mounts ssh-agent
  2. Copy id_rsa into docker container
  3. Fetch dependencies, then run the docker build - possible but ugly - and doesn’t work well with build caching (invalidates the cache).

I’ve had an idea of a possible solution. A ssh git proxy running in the same docker network, with the hostname github.com

  1. You provide a machine user SSH key as credentials when starting the git proxy - the SSH key can read all required repositories, but not write.
  2. Your build containers is also configured to use this network (lets call it ‘ci’)
  3. Your build runs, it makes git ssh requests to download dependencies, but thanks to the magic of docker hostnames it’s actually talking to the proxy.
  4. The proxy deleagates to github, pulls the repo, maybe caches it, and returns it to the build containers.
  5. $profit$ - well actually no profit, it’s open-source

I was wondering could some part of your project be reused to achieve this goal - it would really improve the CI story for Erlang/Elixir vs go (where all the dependencies are just ‘vendored’ (copy-n-pasted) into the repository.


   +-------------------------Network 'ci'-----------------------------+
   |                                                                  |
   |                                                                  |
   |   +----------------+    Fetch dependency  +------------------+   |
   |   |                |    (git ssh)         | Docker container |   |
   |   |  docker build  +----------------------> (github.com)     |   |
   |   |                |                      |                  |   |
   |   +----------------+                      +------------------+   |
   |                                                     |            |
   |                                                     |            |
   +------------------------------------------------------------------+
                                                         |
                                                         |
                         +--------------------------+    |
                         |                          |    |
                         |     Github.com           +<---+
                         |                          |  Fetch and cache
                         |                          |
                         |                          |
                         +--------------------------+



I’m thinking of tools like :

  1. GitHub - kurzdigital/git-cache-http-server-docker: git-cache-http-server as a Docker container · GitHub
  2. https://github.com/bryanhuntesl/apt-cacher-ng

Thanks,

Bryan