6

I am mirroring a popular go library in my organizations gitlab's group (for redundancy).

In my code I have: import ( "gitlab.com/org/group/library.git" )

I used this answer for guidance on using go get with a private repository. On my machine go get ./... works because I configured git using the following command:

$ git config --global url.git@gitlab.com:.insteadOf https://gitlab.com/

When I try to build a docker container the command RUN go get ./... fails with the following output:

package gitlab.com/org/group/library.git: cannot download, git://gitlab.com/org/group/library uses insecure protocol

It seems the popular answer from a similar thread or this article is to do something like upload your ssh keys to the docker container. I don't really feel comfortable with that because I don't exactly understand what is doing, or the security implications.

Any insight on how to properly configure my dockerfile or my golang work flow would be of great assistance.

danielsmith1789
  • 1,056
  • 1
  • 12
  • 25
  • Read [an article](https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066) today about new improvements in docker that allows sharing secrets during docker build time. Does that help? – msound Nov 14 '18 at 03:11
  • I am using this approach for my environment variables that I need to inject into my containers, this doesn't really apply to using a private repository as a pkg in my gland project. – danielsmith1789 Nov 16 '18 at 17:45

1 Answers1

0

It appears that golang v1.11 includes modules.

To quote the source

A module is a collection of related Go packages that are versioned together as a single unit. Most often, a single version-control repository corresponds exactly to a single module.

Using the latest version of golang along with modules allows me to use all of my dependencies.

danielsmith1789
  • 1,056
  • 1
  • 12
  • 25