Tutorial fails to build
Closed this issue · 2 comments
https://open-match.dev/site/docs/tutorials/matchmaker101/frontend/
https://github.com/googleforgames/open-match/tree/main/tutorials/matchmaker101/frontend
docker build -t $REGISTRY/mm101-tutorial-frontend frontend/
does not succeeed
I can build the project just fine with go build .
, which makes sense to me
What doesn't make sense is how this could compile given the relative path specification ../../../
in go.mod
to the local open-match module which is not included in the Dockerfile
That being said I'm a complete beginner with Go, so possibly there is some basic Go concept I am missing here
docker build -t $REGISTRY/mm101-tutorial-frontend frontend/
[+] Building 11.7s (8/8) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:alpine 10.6s
=> [1/4] FROM docker.io/library/golang:alpine@sha256:42d35674864fbb577594b60b84ddfba1be52b4d4298c961b46ba95e9fb4 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 203B 0.0s
=> CACHED [2/4] WORKDIR /app 0.0s
=> CACHED [3/4] COPY . . 0.0s
=> ERROR [4/4] RUN go build -o frontend . 1.0s
------ >
[4/4] RUN go build -o frontend .:
#7 0.674 go: open-match.dev/open-match@v0.0.0-dev (replaced by ../../../): reading /go.mod: open /go.mod: no such file or directory #7 0.674 go: downloading google.golang.org/grpc v1.36.0
#7 0.960 go: open-match.dev/open-match@v0.0.0-dev (replaced by ../../../): reading /go.mod: open /go.mod: no such file or directory ------
executor failed running [/bin/sh -c go build -o frontend .]: exit code: 1
Hi @narthur157, Please try making below changes in dockerfiles. you may also put latest
in place of v1.3.0
.
Hi @narthur157, Please try making below changes in dockerfiles. you may also put
latest
in place ofv1.3.0
.
This is what I needed! Although I did have to add RUN apk add --no-cache git
because the alpine image doesn't include git
FROM golang:alpine as go
WORKDIR /app
ENV GO111MODULE=on
RUN apk add --no-cache git
COPY . .
RUN go mod edit -replace open-match.dev/open-match@v0.0.0-dev=open-match.dev/open-match@v1.3.0
RUN go mod tidy
RUN go build -o frontend .
CMD ["/app/frontend"]
This is what worked for me here