Reputation: 2441
I've followed a couple of tutorials and am having trouble figuring out what i've done wrong. I suspect its a very basic principal but that said as i'm new to both GoLang and docker-compose i'm not 100% sure which is my problem.
I'm running the golang:build docker image which just retrieves a couple github repositories.
Any help would be much appreciated.
The error is as follows:
+ exec go get -v -d
can't load package: package app: no buildable Go source files in /go/src/app
Service 'ddd' failed to build: The command '/bin/sh -c go-wrapper download' returned a non-zero code: 1
The Docker-Compose file looks like this
ddd:
build: ./goSvc
working_dir: /go/src/
command: go run main.go
volumes:
- ./goSvc/src/main.go:/go/src/main.go
- ./goSvc/src/ddd:/go/src/ddd
ports:
- 8080:8080
environment:
- DB_NAME=rnse
- DEBUG=true
Go project structure
root
goSvc
pkg
src
ddd
internal
logic
...myGoFiles
github.com
main.go
Dockerfile
Edit: Including docker file for golang:
FROM golang:onbuild
RUN go get github.com/gorilla/mux
RUN go get github.com/lib/pq
EXPOSE 8080
Upvotes: 3
Views: 2758
Reputation: 5488
Image you used is used to automatically build Go app when building initial image.
Have a look at it's Dockerfile. There is ONBUILD COPY . /go/src/app
statement.
So you can either locate Dockerfile where main.go
is located or use image without ONBUILD
trigger and then run go run
manually/with docker-compose
.
Upvotes: 3