Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): setup multiarch build for arm64 #1161

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Darkbladecr
Copy link

According to issue #1160 #1138

I do not know what the CI environment is for building the docker images. But I have updated the Dockerfile to be able to accommodate multiarch builds. Note my environment is arm64 so I have to set up the docker for amd64, the converse may be true for your build CI environment.

As per the multi_arch script the docker buildx environment needs to be setup:

docker context create container
docker buildx create --use container

I assume the CI is a linux environment in which case buildx needs to be installed: https://github.com/docker/buildx?tab=readme-ov-file#linux-packages

@CLAassistant
Copy link

CLAassistant commented Jan 25, 2024

CLA assistant check
All committers have signed the CLA.

@mofirouz
Copy link
Member

Thanks for this. Do you have a way to update the build README for binary releases too?

@Darkbladecr
Copy link
Author

Thanks for this. Do you have a way to update the build README for binary releases too?

I haven't touched the binary workflow, so they should work as setup previously. I wanted to try and avoid any breaks with existing code or CI/CD. If you want me to clean everything up so that it works with this single Dockerfile, and update the readme for how to run it for any platform with docker buildx I can do that?

@Darkbladecr
Copy link
Author

Darkbladecr commented Jan 25, 2024

Removed duplicate docker builds for both the main server and the pluginbuilder
Added info on how to use/setup in the README.md

Updated the scripts to automatically pull the latest tag and info:

VER="$(git tag -l --sort=-creatordate | head -n 1)"
DOCKER_VER=heroiclabs/nakama:${VER:1}
echo Building $DOCKER_VER
docker buildx build --platform linux/amd64,linux/arm64 \
  --builder=container \
  --build-arg repo=https://github.com/heroiclabs/nakama.git \
  --build-arg commit="$(git rev-parse --short HEAD)" \
  --build-arg version=$VER \
  --tag $DOCKER_VER \
  --push .

Note the --build-arg repo is not required there is a default, but I realized as I was trying this out on my fork the build was failing as it could not find the latest commit for checkout. So this is now an optional argument that can be passed for development on forks.

@Darkbladecr
Copy link
Author

Darkbladecr commented Jan 31, 2024

Anything else that needs to be done here @mofirouz ?
Do I need to create an implementation on CI with github actions?

@tobyw121
Copy link

hello , please have a look at my Github : https://github.com/tobyw121/nakama_docker_aarch64/tree/main

I have created a docker for a Nakama on aarch64 here .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants