去docker错误中获取golang-migrate

I am trying to set up a small first time app in go using Docker. I want to use the cli tools for go-lang migrate. However I receive the following error:

package github.com/golang-migrate/migrate/v4/internal/cli: cannot find package "github.com/golang-migrate/migrate/v4/internal/cli" in any of: /usr/local/go/src/github.com/golang-migrate/migrate/v4/internal/cli (from $GOROOT) /go/src/github.com/golang-migrate/migrate/v4/internal/cli (from $GOPATH)

The command works fine outside of docker. I'm confused about the set up of my Dockerfile, my GOPATH appears to be fine as well.

I have a Dockerfile with the following lines:


RUN apk --update add alpine-sdk

WORKDIR $GOPATH/src/github.com/go-projects/docker-test/

RUN echo $GOPATH

RUN go get -u -d github.com/golang-migrate/migrate/cli github.com/lib/pq```

I was able to get this working in a Docker container with the following:

FROM golang:1.12rc1-alpine3.9 AS build  # or replace with your desired build

RUN apk --update add alpine-sdk

COPY . $GOPATH/src/github.com/go-projects/docker-test/

WORKDIR $GOPATH/src/github.com/go-projects/docker-test/

RUN echo $GOPATH

RUN go get -u -d github.com/golang-migrate/migrate github.com/lib/pq

Additionally, it is suggested to use cmd/migrate instead of cli per this commit