According to this post: What does go build build?
go build builds the binary and leaves it in the current directory, while go install moves the binary into $GOPATH/bin.
This works on my machine like that. However, I have a Dockerfile:
FROM golang:latest
ADD . /go/src/myapp
WORKDIR /go/src/myapp
RUN go get .
RUN go build
RUN ls /go/bin # shows myapp!!
ENTRYPOINT ["/go/bin/myapp"] #works!!
There should be no difference here. The expected result was that /go/bin was empty and the binary myapp would be /go/src/myapp/myapp
Instead, I see that build is working like install, and the binary shows up in /go/bin. Why??