You have asked a good question.
The command's order in the Dockerfile really matters. Put first the things that don't change frecuently, and later those that are most likely to change in every build:
FROM golang:1.8 RUN go get -d -v ./... RUN go install -v ./... COPY . /go/src/github.com/codeblooded/test1 WORKDIR /go/src/github.com/codeblooded/test1 RUN echo $PATH RUN go build -o test1 . CMD ["test1"] EXPOSE 3470
When a layer change regarding previous build, docker discards the following cached layers an runs them again, sometimes wasting your time.
Pay attention to the "Using cache" sentence that docker output in each layer that is re-used from previous build.
Another recommendation, for your dev work, use fresh to re-build your go app automatically every time you change the code. Just installing it in the container and simply using
command: fresh in your docker-compose.yml