Docker Community Forums

Share and learn in the Docker community.

Create a docker image with dockerfile using go get repository on Code Commit?

Expected behavior

When building an image with dockerfile I’m pulling a Go repository from Code commit. I expect it to work given correct credentials

Actual behavior

It does not work, the build fails with errors saying:
package unrecognized import path "" (parse no go-import meta tags ())

Additional Information

I have cloned and built this repository from source on my local machine:

I then pushed the repo to our Code Commit instance. The plan is to modify parts of this application, package it into a Docker image and then run it on AWS. However, as I said, the build fails because Docker cannot authenticate against our repo on code commit. My Dockerfile looks like this;

#Use latest golang version
FROM golang:latest


#Install Java
RUN apt-get -y update && apt-get install -y openjdk-8-jre-headless

#Get the battery historian code and run the setup
#These links should use code commit. 
#RUN go get -d -u
RUN go get -d -u

WORKDIR /go/src/
RUN go run setup.go

#Open default port

#Run the start file for battery historian in a container
CMD go run cmd/battery-historian/battery-historian.go --port 8888 --name my-battery-historian

So my question is basically:How do I use go get with HTTPS or SSH connecting to a repository on Code Commit?