-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Nakama ARM build should be published with the same docker version tag #1222
Comments
It seems easy to accomplish if Docker images are built from GitHub. If that's not the case it's not that hard anyway, just three steps:
Here's a GitHub Actions workflow that does this. It requires two secrets (the Docker hub login credentials). It publishes a single multi-platform (linux/amd64 and linux/arm64) Docker image when a new release is created: name: docker-image
on:
release:
types:
- created
env:
IMAGE_NAME: "heroiclabs/nakama"
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set env vars
run: |
echo "ARG_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "ARG_VERSION=$(echo -n ${{ github.event.release.name }} | cut -c2-)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
# registry: "..." # if not using Docker Hub check https://github.com/docker/login-action?tab=readme-ov-file#usage
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: "build/Dockerfile"
build-args: |
commit=${{ env.ARG_COMMIT }}
version=${{ env.ARG_VERSION }}
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} EDIT (28/07/2024): Updated workflow. Check changes to Dockerfile and Action results on my fork. |
We're taking a look at this for the next release, until then using the separate tag should work. |
Made a working example, you can check the diff here. Simpler approach than #1161 The resulting multi-platform image is available in this public Docker Hub repo: EDIT: Tried the image on Windows (11), Linux (Ubuntu 22.04) and OSX (Sonoma 14.5) hosts. |
@zyro any status here? happy to help if you guys are having issues |
@smsunarto It would be great to have a pull request to review if you have time 🙏 |
It seems like the Nakama ARM images (https://hub.docker.com/r/heroiclabs/nakama/tags) is version tagged separately as
vX.X.X-arm
. This unfortunately makes it difficult to do downstream multi-platform builds as it would require a separate Dockerfile that imports different base image version tags.The Docker best practice seems to be to publish different platform images under the same version tag and let docker buildx automatically select the correct image based on the platform. By doing it this way, you can do multi-platform builds using a single Dockerfile.
For example:
The text was updated successfully, but these errors were encountered: