dahernan / godockerize

Generate a Dockerfile for you Go microservice, the Dockefile compiles, get the dependencies with godep, and sets the entrypoint
Apache License 2.0
27 stars 5 forks source link

godep: No Godeps found (or in any parent directory) #2

Open joeblew99 opened 8 years ago

joeblew99 commented 8 years ago

hey

This is really nice. thanks. SO trying this out.

I am on Mac and go 1.5.1, with standard docker tools installed. i suspect the problem is that gopherscraper is NOT using godeps ?


# Go to the root directory of your project, for example
$ cd $GOPATH/src/github.com/dahernan/gopherscraper

# Run godockerize exposing the port 3001
$ godockerize -expose 3001

Dockerfile generated, you can build the image with:
$ docker build -t gopherscraper .

Output is:

Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
Setting environment variables for machine default...

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

Your Environment is setup with the following paths:
Home:                /Users/apple
Nvm (node):              /Users/apple/.nvm
GoRoot:              /usr/local/go
GoPath:              /Users/apple/workspace/go
GoAppengine:             /Users/apple/workspace/go_appengine
Android SDK Platform Tools:              /Users/apple/Library/Android/sdk/platform-tools
Android SDK Tools:               /Users/apple/Library/Android/sdk/tools
gedw99-MacBook-Pro:gopherscraper apple$ cd /Users/apple/workspace/go/src/github.com/dahernan/gopherscraper
gedw99-MacBook-Pro:gopherscraper apple$ ls
Dockerfile      curl_examples.txt   model           scraper
LICENSE         elasticsearch       redis           server.go
README.md       jsonrequest     routes          test
gedw99-MacBook-Pro:gopherscraper apple$ docker build -t gopherscraper .
Sending build context to Docker daemon 352.3 kB
Step 1 : FROM google/golang:stable
stable: Pulling from google/golang
d634beec75db: Pull complete 
ce61c2c2ebde: Pull complete 
f777caa83c8a: Pull complete 
d4cd5af745b9: Pull complete 
22b61846144d: Pull complete 
ff285605d113: Pull complete 
8fbe062ceefc: Pull complete 
863c1f540ebb: Pull complete 
9dd2d0677202: Pull complete 
Digest: sha256:15ba009e643b730acbe50fe56c0c4bf15724acd0b42f7117db2f7038fed05e25
Status: Downloaded newer image for google/golang:stable
 ---> 9dd2d0677202
Step 2 : RUN go get github.com/tools/godep
 ---> Running in f39e9e06a384
 ---> 7d03148a025d
Removing intermediate container f39e9e06a384
Step 3 : RUN CGO_ENABLED=0 go install -a std
 ---> Running in f4e0b1c95edf
 ---> 300a6c64d159
Removing intermediate container f4e0b1c95edf
Step 4 : MAINTAINER dahernan@gmail.com
 ---> Running in 8a2d6147be94
 ---> 12d44f4335f7
Removing intermediate container 8a2d6147be94
Step 5 : ENV APP_DIR $GOPATH/src/github.com/dahernan/gopherscraper
 ---> Running in a9b4bdd3c9c2
 ---> a1089863a54a
Removing intermediate container a9b4bdd3c9c2
Step 6 : ENTRYPOINT /opt/app/gopherscraper
 ---> Running in 7ca04ecb0238
 ---> 179448a6c630
Removing intermediate container 7ca04ecb0238
Step 7 : ADD . $APP_DIR
 ---> e9c84835eb4f
Removing intermediate container 36fca0c09ffd
Step 8 : RUN mkdir /opt/app
 ---> Running in 35f353efb575
 ---> 8bdd987365a0
Removing intermediate container 35f353efb575
Step 9 : RUN cd $APP_DIR
 ---> Running in fe1fd77d9ece
 ---> 27be0ba7aac2
Removing intermediate container fe1fd77d9ece
Step 10 : RUN cd $APP_DIR && CGO_ENABLED=0 godep go build -o /opt/app/gopherscraper -ldflags '-d -w -s'
 ---> Running in f5706c7f223f
godep: No Godeps found (or in any parent directory)
The command '/bin/sh -c cd $APP_DIR && CGO_ENABLED=0 godep go build -o /opt/app/gopherscraper -ldflags '-d -w -s'' returned a non-zero code: 1
dahernan commented 8 years ago

You are right, gopherscraper hasn't godeps, you need to godep save before dockerize