Every RUN command starts a new shell with a clean environment and a new default working directory. In particular,
RUN cd ... as an isolated step does nothing.
If you do actually need to change directories in a Dockerfile, either combine the two steps into one or use a
WORKDIR directive to make the change more globally.
In the specific case of a Go repository, since there's a standard directory layout that's at least very strongly encouraged, I'd run with it:
FROM golang WORKDIR /go/src/github.com/me/myprogram COPY . ./ RUN go install . CMD ["/go/bin/myprogram"]
(In general Go deals with whole directories or "packages" of related files, and not necessarily individual