Golang: go build failing when called as part of makefile

I have the following make file:

default: builddocker

     go get github.com/golang/protobuf/proto
     go get github.com/golang/protobuf/protoc-gen-go
     go get golang.org/x/net/context
     go get google.golang.org/grpc

    CGO_ENABLED=0 GOOS=linux go build -ldflags "-s" -a -installsuffix cgo -o main ./customer-server/

                    docker build -t johnwesonga/grpc/customer-server -f ./Dockerfile.build .
                    docker run -t johnwesonga/grpc/customer-server /bin/true
                    docker cp `docker ps -q -n=1`:/main .
                    chmod 755 ./main
                    docker build --rm=true --tag=johnwesonga/grpc/customer-server -f Dockerfile.static .

My Dockerfile.build has:

  • Why am I getting a permission denied error on docker/aws eb?
  • How to configure freeSWITCH for a docker container inside boot2docker?
  • Why does CMD never work in my Dockerfiles?
  • RSA server certificate apache2
  • Docker: ECS vs Beanstalk vs Docker Cloud
  • `docker run -v` doesn't work as expected
  • FROM golang
    ADD Makefile /
    RUN make setup
    RUN make buildgo
    CMD ["/bin/bash"]

    But every time I run “make builddocker” I get the following error:

    CGO_ENABLED=0 GOOS=linux go build -ldflags "-s" -a -installsuffix cgo -o main ./customer-server/
    can't load package: package ./customer-server: open /customer-server: no such file or directory
    make: *** [buildgo] Error 1
    Makefile:10: recipe for target 'buildgo' failed
    The command '/bin/sh -c make buildgo' returned a non-zero code: 2
    make: *** [builddocker] Error 2

    But if I run “Make buildgo” it works just fine, any idea why this is failing?

    FYI my source tree as follows:


  • Backup of Docker image
  • Connect docker container to database in host's local network
  • Docker compose scaling down and Consul
  • Docker, Cannot connect to the Docker daemon. Is the docker daemon running on this host?
  • Install Fabric8 on openshift docker instance
  • How to install an application in Hadoop Cluster using YARN?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.