mrserverless / serverless-golang

AWS Lambda Go functions using Serverless Framework and Python shim
Other
302 stars 21 forks source link

build with private repos #36

Closed siegesmund closed 6 years ago

siegesmund commented 6 years ago

I'm having trouble getting this package to work with private repositories. My function imports a package that exists on my local machine. However, dep tries to import it from its' private GitHub repo from within the docker container, causing the build to fail.

This seems like a pretty common use case, so is there a pattern to handle this?

mrserverless commented 6 years ago

For private repos you can mount your ssh keys into the container by adding:

~/.ssh:/root/.ssh

to you docker-compose.yml volume section. I.e. here https://github.com/yunspace/serverless-golang/blob/master/examples/aws-golang-event/docker-compose.yml#L8

For pulling packages from your local machine you can mount your GOPATH into the container:

/your-go-path:/go

Hope this helps!