Driver & Docker Headache

No I have been trying to dockerize my go api which is supposed to use the new driver to connect to a database installed in another container. I have followed an article and thanks to the author, I was able to build the application using docker-compose but when running I get this error

cannot find package "github.com/neo4j/neo4j-go-driver/neo4j" in any of:
/usr/local/go/src/github.com/neo4j/neo4j-go-driver/neo4j (from $GOROOT)
/go/src/github.com/neo4j/neo4j-go-driver/neo4j (from $GOPATH)

From my findings, the app can't find the package which was imported. Below is my dockerfile --

# start from golang image based on alpine-3.8
FROM golang:1.10-alpine3.8 AS dev-build

# add our cgo dependencies
RUN apk add --update --no-cache ca-certificates cmake make g++ openssl-dev git curl pkgconfig
# clone seabolt-1.7.0 source code
RUN git clone -b v1.7.0 https://github.com/neo4j-drivers/seabolt.git /seabolt 
# invoke cmake build and install artifacts - default location is /usr/local
WORKDIR /seabolt/build
# CMAKE_INSTALL_LIBDIR=lib is a hack where we override default lib64 to lib to workaround a defect
# in our generated pkg-config file 
RUN cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_LIBDIR=lib .. && cmake --build . --target install

# install dep
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

WORKDIR /go/src/app
ADD . /go/src/app

# install dependencies
RUN dep init && dep ensure -add github.com/neo4j/neo4j-go-driver/neo4j

# Install Dependencies
RUN go get github.com/ampersandlabs-io/jwt-auth-filter
RUN go get github.com/bradfitz/gomemcache/memcache
RUN go get github.com/gorilla/mux
RUN go get github.com/paulmach/go.geojson
RUN go get gopkg.in/mgo.v2/bson
RUN go get github.com/joho/godotenv
RUN go get github.com/lib/pq
RUN go get github.com/rs/cors

CMD ["go", "run", "main.go"]

Thank you for your help

@ali.ince, you might be able to help out.

I was able to get help from @ali.ince. Check out this link if you are interested,
here

1 Like