I am trying to create a docker image with my golang project. The project has some local packages like math:
/myproject/
src/
main.go
utils/
math.go
in main.go I include lots of packages but also math
from math.go.
My docker file looks something like:
FROM golang:latest
ENV GOPATH=/golib/
RUN /usr/local/go/bin/go get github.com/julienschmidt/httprouter
CMD /usr/local/go/bin/go run main.go
EXPOSE 10004
How do I include also math package since it's a local package, so it's not deployed on github?
The yml file:
services:
cozonac:
image: cozonac:local
ports:
- "10004:10004"
volumes:
- ./src/:/go/
Thanks
You should try below
services:
cozonac:
image: cozonac:local
ports:
- "10004:10004"
volumes:
- ./src/:/go/
environment:
- GOPATH=/golib/:/go/
Just for this case you can append the folder to GOPATH