grocy / grocy-docker

ERP beyond your fridge - now containerized - this is the docker repo of https://github.com/grocy/grocy
MIT License
419 stars 121 forks source link

Build and publish multi-architecture container manifests #156

Closed jayaddison closed 2 years ago

jayaddison commented 3 years ago

Experimental. Resolves #105.

jayaddison commented 3 years ago

@Kritzefitz I'm not completely sure how to test this, but thought I would tag you here in case you're able to take a look and spot any errors I might have made.

cc @divyansh42 - thank you for implementing manifest support in the relevant GitHub Actions. Hopefully this repository can provide an example of them in use (there might be a few details to work out along the way; I'm not sure whether the workflow defined here is correct yet).

jayaddison commented 3 years ago

Ok, this has been tested using a temporary fork of this repository.

Here is a sample workflow build output which proceeds to the point at which it attempts to push to the Docker Hub registry (and then fails -- as expected -- due to lack of configured credentials in the repository fork):

https://github.com/jayaddison/grocy-docker/runs/4346875443

...
✅ Successfully built images "backend:v3.1.3-multiarch-test-2-linuxamd64, backend:v3.1.3-multiarch-test-2-linuxarm64v8" and manifest "backend:v3.1.3-multiarch-test-2"
...
✅ Successfully built images "frontend:v3.1.3-multiarch-test-2-linuxamd64, frontend:v3.1.3-multiarch-test-2-linuxarm64v8" and manifest "frontend:v3.1.3-multiarch-test-2"
...
⏳ Pushing "backend:v3.1.3-multiarch-test-2" to "docker.io/grocy/backend:v3.1.3-multiarch-test-2" respectively
/usr/bin/podman manifest push --quiet --digestfile backend-v3.1.3-multiarch-test-2_digest.txt backend:v3.1.3-multiarch-test-2 docker.io/grocy/backend:v3.1.3-multiarch-test-2 --all --tls-verify=true
Error: writing blob: initiating layer upload to /v2/grocy/backend/blobs/uploads/ in registry-1.docker.io: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
...
Error: podman exited with code 125

So I think that this is nearing readiness, and that configuring credentials for this should make it possible to push a multi-arch container manifest.

Whether the application works as expected on additional architectures is TBD.

jayaddison commented 2 years ago

I'm going to take a bit of a gamble and merge this to keep the build infrastructure for grocy-docker progressing (often I like to wait until code review approval is available, but I think we are still building up capacity for that in this repo). Please feel free to perform post-merge code review on this @Kritzefitz @divyansh42.

jayaddison commented 2 years ago

:tada: Success! ... I think? :question:

After a couple of build failures during the first two release attempts (a permissions failure because I hadn't whitelisted the appropriate GitHub actions, and then an ephmeral DNS resolution problem), the container build and publish workflow has completed successfully.

The manifests appear published on Docker Hub, although oddly they don't display size, architecture or digest details -- and, separately, something is up with the sort ordering (these screenshots are with 'sort by newest' / (last_updated) selected..)

image

image

I've been able to pull these and run the application locally, albeit only on amd64. I haven't yet tested the arm64 containers.

unusualevent commented 1 year ago

FYI these manifests aren't being pushed for linux/arm/v7.

herrniffler commented 1 year ago

doesn't work for me either.