Skip to content

Tutorial: How to build a basic Matchmaker cannot build container image #1470

@govargo

Description

@govargo

What happened:

I'm new to OpenMatch and I tried the first tutorial How to build a basic Matchmaker.
When I tried the building images of frontend, director, matchfunction, I could not build these with the error.

% docker build -t $REGISTRY/mm101-tutorial-frontend .
[+] Building 4.7s (9/9) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 740B                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/golang:alpine                                                                                                                                      2.1s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => [1/4] FROM docker.io/library/golang:alpine@sha256:7cc62574fcf9c5fb87ad42a9789d5539a6a085971d58ee75dd2ee146cb8a8695                                                                                0.0s
 => [internal] load build context                                                                                                                                                                     0.0s
 => => transferring context: 90.73kB                                                                                                                                                                  0.0s
 => CACHED [2/4] WORKDIR /app                                                                                                                                                                         0.0s
 => CACHED [3/4] COPY . .                                                                                                                                                                             0.0s
 => ERROR [4/4] RUN go build -o frontend .                                                                                                                                                            2.3s
------
 > [4/4] RUN go build -o frontend .:
#9 1.027 go: open-match.dev/open-match@v0.0.0-dev (replaced by ../../../): reading /go.mod: open /go.mod: no such file or directory
#9 1.030 go: downloading google.golang.org/grpc v1.36.0
#9 2.220 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

What you expected to happen:

I can build the images of frontend, director, matchfunction.

How to reproduce it (as minimally and precisely as possible):

# ref: https://open-match.dev/site/docs/tutorials/matchmaker101/
REGISTRY=[MY_REGISTRY_URL]
git clone https://github.com/googleforgames/open-match.git
cd open-match
TUTORIALROOT=$(pwd)/tutorials/matchmaker101

kubectl create namespace mm101-tutorial

# ref: https://open-match.dev/site/docs/tutorials/matchmaker101/frontend/
# edit frontend/ticket.go, director/profile.go, matchfunction/mmf/matchfunction.go
cd $TUTORIALROOT
docker build -t $REGISTRY/mm101-tutorial-frontend frontend/

I described the frontend image, however, the director and matchfunction also have build problem.

Anything else we need to know?:

The reason why the build failed is go.mod specified open-match root directory, however, docker build context doesn't include the root directory.

# go.mod
replace open-match.dev/open-match v0.0.0-dev => ../../../  // this is targeted at root path of open-match

docker build command docker build -t $REGISTRY/mm101-tutorial-frontend frontend/ specifies only frontend/ directory.

To fix this, we have to fix build context path and file copy path.

I think this issue is similar to #1171.

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

Minikube v1.25.2

Open Match Release Version:

v1.24.0-rc

Install Method(yaml/helm):

YAML
https://open-match.dev/site/docs/installation/yaml/

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/developer-experienceThis issue impacts developer experience when building a Matchmaker using Open Matchkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions