Sign inSign up

heroiclabs/nakama-pluginbuilder

By heroiclabs

•Updated 15 days ago

A support container to build Go code for Nakama server's runtime.

Image
3

100K+

heroiclabs/nakama-pluginbuilder repository overview

⁠Nakama Plugin Builder

A support container to build Go code for Nakama server's runtime

The game server includes support to develop native code in Go with the plugin⁠ package from the Go stdlib. It's used to enable compiled shared objects to be loaded by the game server at startup.

The Go runtime support can be used to develop authoritative multiplayer match handlers, RPC functions, hook into messages processed by the server, and extend the server with any other custom logic. It offers the same capabilities as the Lua runtime⁠ support but has the advantage that any package from the Go ecosystem can be used.

⁠Usage

This image can be used to execute the Go toolchain and cross-compile Go code for the Alpine container base images used with official Docker image releases.

  1. Use the Docker plugin helper container to compile your project.

    cd $GOPATH/src/plugin_project # Your project folder.
    docker run --rm -v "$PWD:/go/src/your_project" heroiclabs/nakama-pluginbuilder:2.4.2 build --buildmode=plugin -o ./modules/your_project.so
    

    In the command above we bind-mount your current folder into the container and use the Go toolchain inside it to run the build. The output artifacts are written back into your host filesystem.

  2. Use our official Docker Compose file⁠ to run all containers together and load in your custom module.

    docker-compose -f ./docker-compose.yml up
    

    By default the server will be started and look in a folder relative to the current dir called "./modules" to load code.

    TIP: Use the same version of your plugin builder image as used in the Docker Compose file for the server version. i.e. "heroiclabs/nakama:2.4.2" <> "heroiclabs/nakama-pluginbuilder:2.4.2"

For more information have a look at the documentation⁠ on how to build Go code for the server.

Tag summary

Content type

Image

Digest

sha256:eb506121e…

Size

290 MB

Last updated

15 days ago

docker pull heroiclabs/nakama-pluginbuilder