I get a strange error in docker when building my go app:
./main.go:31:9: cannot use db (type *"github.com/khwerhahn/somerepo/vendor/github.com/jinzhu/gorm".DB) as type *"app/vendor/github.com/jinzhu/gorm".DB in argument to Migrate
The command '/bin/sh -c go-wrapper install' returned a non-zero code: 2
Could somebody hint me into the right direction, because locally the app runs just fine. Its just inside the docker container. I use glide
to manage dependencies.
Dockerfile:
FROM golang:1.9
WORKDIR /go/src/app
COPY . .
RUN go-wrapper download
RUN go-wrapper install
CMD ["go-wrapper", "run"]
//// Edit This is how my structure looks. Glide
manages the vendor folder. The docker build does the rest.
It's because go get
is called by go-wrapper download
. This fetches the dependencies from the remote instead of looking in the vendor folder.
If your libraries are already vendored and the code is in the vendor
folder, all you should have to do is go run
or go install
.
and why do you need go-wrapper when you can just do.
RUN glide install
RUN go install
WORKDIR "../bin"
RUN myapp