Skip to content

Conversation

@einola
Copy link
Member

@einola einola commented Jun 3, 2025

Enable multiplatform build of the docker image

Fixes #864

Task List

  • Defined the tests that specify a complete and functioning change (It may help to create a design specification & test specification)
  • Implemented the source code change that satisfies the tests
  • Documented the feature by providing worked example
  • Updated the README or other documentation
  • Completed the pre-Request checklist below

Change Description

Add "platforms: linux/amd64,linux/arm64" to docker.yml. This should allow github to build a multiplatform image.


Test Description

Trigger a build and confirm that the image built works on both amd64 and arm64 machines.


Documentation Impact

N/A


Other Details

None


Pre-Request Checklist

  • The requirements of this pull request are fully captured in an issue or design specification and are linked and summarised in the description of this PR
  • No new warnings are generated
  • The documentation has been updated (or an issue has been created to track the corresponding change)
  • Methods and Tests are commented such that they can be understood without having to obtain additional context
  • This PR/Issue is labelled as a bug/feature/enhancement/breaking change
  • File dates have been updated to reflect modification date
  • This change conforms to the conventions described in the README

Just adds "platforms: linux/amd64,linux/arm64" to docker.yml
@einola
Copy link
Member Author

einola commented Jun 3, 2025

It wasn't that easy, unfortunately! The arm64 build fails with a problem with spack: (link to failure in log). Strangely, the image builds fine on my M1 Mac. Any ideas @TomMelt?

@TomMelt
Copy link
Contributor

TomMelt commented Jun 4, 2025

Hi @einola and @auraoupa , it's hard for me to look into these things because I don't have an arm64 system.

FWIW, if you managed to build the docker image locally, you could push it manually to the github container repository (under a different name) and users could download it from there.

Would that work?

@TomMelt
Copy link
Contributor

TomMelt commented Jun 4, 2025

@einola , here's some instructions on how to push a new image to the GHCR:

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry

You need to create a Github access token but it tells you how to do it in the guide. You then use that to docker push the image onto GitHub.

Make sure you give it a different name e.g., ghcr.io/nextsimhub/nextsimdg-dev-mac-env:latest otherwise it will overwrite the current image

@TomMelt
Copy link
Contributor

TomMelt commented Jun 4, 2025

I probably wont be able to do it before tomorrow but I will take a look at the docker github workflow

@einola
Copy link
Member Author

einola commented Jun 5, 2025

Hi @TomMelt,

Good suggestions - thanks! I'll build locally and push to ghcr, as you suggested. It would be nice to have multi-platform working, but if we take this workaround for now, then there's no rush.

@einola
Copy link
Member Author

einola commented Jun 5, 2025

Well, I built it with

docker build . -f Dockerfiles/Dockerfile.devenv -t nextsimdg-dev-env

and then did

docker tag nextsimdg-dev-env ghcr.io/nextsimhub/nextsimdg-dev-mac-env:latest

and

docker push ghcr.io/nextsimhub/nextsimdg-dev-mac-env:latest

but got

The push refers to repository [ghcr.io/nextsimhub/nextsimdg-dev-mac-env]
50eca8a23725: Preparing 
a19335d1d092: Preparing 
5fbb7c908983: Preparing 
2d76f8a816f7: Preparing 
82deb900ace6: Preparing 
06ee4d86a028: Waiting 
215e0e036e52: Waiting 
c2f2f00da4eb: Waiting 
unauthorized: unauthenticated: User cannot be authenticated with the token provided.

And I have no idea how to authenticate :/

@TomMelt
Copy link
Contributor

TomMelt commented Jun 7, 2025

You need to setup a personal access token. The instructions are linked here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic

In step 1 you create a token on GitHub, then you set it as an environment variable on your system. Then you should be able to authenticate when pushing to GitHub container registry. When you create the token make sure you give it the permissions listed in the instructions. I'm back from the conference next week so we can have a teams call if you want and I can guide you through the process

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.

Docker image nextsimdg-env not multiplatform

3 participants