Assume this is the production grade program we need to dockerize and run.

package main

import "fmt"

func main() {
     fmt.Println("saying hello to the world")
}

FROM golang:1.10-alpine as builder
WORKDIR /go/src/github.com/shabinesh/prog
COPY main.go  .
COPY vendor ./vendor
RUN CGO_ENABLED=0 go build -o main .

FROM alpine:latest 
RUN apk --no-cache add ca-certificates
WORKDIR /
COPY --from=0 /go/src/github.com/shabinesh/prog/main .
CMD ["./main"]