I am trying to get a Go app inside a docker container. This is my first bigger Go and Docker project. The go program runs just fine as long as I am running it on my local machine, now I want to run it on EC2 within a docker container. My docker file looks like this:
FROM golang:latest
RUN mkdir /tir
ADD . /tir
WORKDIR /tir
RUN go build -o main .
CMD ["/app/main"]
But I get the following error for every private dependencies:
main.go:17:2: cannot find package "github.com/ser/model" in any of:
/usr/local/go/src/github.com/ser/model (from $GOROOT)
/go/src/github.com/ser/model (from $GOPATH)
When I insert RUN go get ./..
before RUN go build -o main .
, I get the following error for every package:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/ser/endpoints: exit status 128
I have tried a couple of solutions, but none worked. I always end up having the above errors. Since this is my first docker + golang project, are there any ready to use dockerfiles for an golang app with public as well as private dependencies?
UPDATE: I deinstalled go, and copied every file in one by one and used dep -ensure after every file. Now it works, thanks :D