Generating the docker image when open-match proto api is updated

46 Views Asked by At

I'm trying to make some changes in the Google's open-match matchmaking library. https://github.com/googleforgames/open-match

After making the necessary changes in the protobuf definitions, the build command runs successfully locally. However, while trying to build the docker image to test it in the k8s environment, the build fails, because it cannot find the protobuf changes made in the project.

I have based my changes on one of the tutorial examples provided in the repo. So here is how the dockerfile for building matchfunction looks like:

FROM golang:alpine as go

WORKDIR /app
ENV GO111MODULE=on

COPY . .

RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o matchfunction .

CMD ["/app/matchfunction"]

The error I'm getting is:

18.12 # open-match.dev/open-match/tutorials/hack/matchfunction/mmf
18.12 mmf/matchfunction.go:80:40: undefined: pb.LatencyMap
18.12 mmf/matchfunction.go:83:26: undefined: pb.LatencyMap
------
Dockerfile:24
--------------------
  22 |     RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
  23 |     RUN go mod tidy
  24 | >>> RUN go build -o matchfunction .
  25 |     
  26 |     CMD ["/app/matchfunction"]
--------------------
ERROR: failed to solve: process "/bin/sh -c go build -o matchfunction ." did not complete successfully: exit code: 1

I believe this is caused by Docker build is trying to base my changes on the library version 1.7.0, but I need to use my local version when building the docker image.

Did anyone who worked with this library face with the same problem ? It does not make sense to assume tutorials will always use the same protobuf definitions. So, they probably haven't considered when preparing the Docker build files.

0

There are 0 best solutions below