Reputation: 4357
I have a little problem with my Go service. I'm new to Go and I just want to dockerize a little service that just connect to a mongodb instance.
My code works fine locally. So here is my Dockerfile:
# build stage
FROM golang:alpine AS build-env
RUN apk add --no-cache git
ADD . .
RUN go get -v -u go.mongodb.org/mongo-driver
RUN go build -o mongotest
# final stage
FROM alpine
WORKDIR /app
COPY --from=build-env ./go/mongotest .
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
EXPOSE 8000
CMD ["./mongotest"]
When I build it, I have this error message :
Step 6/18 : RUN go get -v -u go.mongodb.org/mongo-driver
---> Running in 4c45c601800d
Fetching https://go.mongodb.org/mongo-driver?go-get=1
Parsing meta tags from https://go.mongodb.org/mongo-driver?go-get=1 (status code 200)
get "go.mongodb.org/mongo-driver": found meta tag get.metaImport{Prefix:"go.mongodb.org/mongo-driver", VCS:"git", RepoRoot:"https://github.com/mongodb/mongo-go-driver.git"} at https://go.mongodb.org/mongo-driver?go-get=1
go.mongodb.org/mongo-driver (download)
package go.mongodb.org/mongo-driver: no Go files in /go/src/go.mongodb.org/mongo-driver
The command '/bin/sh -c go get -v -u go.mongodb.org/mongo-driver' returned a non-zero code: 1
no Go files in /go/src
... ok, what can I do with that?
The strange thing is that if I replace
RUN go get -d -u go.mongodb.org/mongo-driver
by
RUN go get -d -u github.com/gorilla/mux
it works!
Is there a problem with mongo driver repo?
Upvotes: 0
Views: 484