louisgrasset / touitomamout

Touitomamout is an easy way to synchronize your Twitter's tweets 🦤 to Mastodon 🦣 and Bluesky post ☁️ (also known as Twitter to Mastodon & Bluesky crossposter)
https://hub.docker.com/r/louisgrasset/touitomamout
GNU Affero General Public License v3.0
116 stars 6 forks source link

Docker Images for Arm #159

Closed QuinnyPig closed 7 months ago

QuinnyPig commented 7 months ago

I find this to be a useful thing to stuff on a Raspberry Pi (or in my case, a k8s cluster on a Raspberry Pi). I was able to manually build an Arm Docker image (and it works correctly), but the process to build images automatically in this repo is... arcane. Is there any appetite for figuring out how to make it build for both?

louisgrasset commented 7 months ago

Hey, I can update the github workflows to create arm compatible images.

Is there a way to make things more clear? Is there any good way of doing? It's interesting

QuinnyPig commented 7 months ago

Big fan of your work!

I'm unsure as to the current state of the art way to do multi-arch builds, particularly with the interplay between Docker, buildx, and GitHub Actions; I did have to remove the explicit --arch=x64 in the Dockerfile; once I did that, it worked correctly to build the image on a Pi.

sudo docker buildx build --platform linux/amd64,linux/arm64 -t quinnypig/touitomamout:1.6.3 --push . on a spare Pi 4 took a while, but did what you'd think it would once I whacked that flag out of the way.

QuinnyPig commented 7 months ago

Maybe it's easier than I thought; https://docs.docker.com/build/ci/github-actions/multi-platform/ has an example of precisely this with the GitHub Action you're already using.

louisgrasset commented 7 months ago

Hey, you can get an arm version here: https://hub.docker.com/r/louisgrasset/touitomamout/tags with the dev tag. I think you'll encounter an error related to the usage of sharp.

In fact, a command is used during the docker image build to specify the right arch to be used by sharp. As of today, this is hard-coded, so I have to find a fix.

Let me know if this is working or not!

QuinnyPig commented 7 months ago

You're right; sharp throws an error:

56269

What's strange is the built-on-arm image I have without the arch flag worked correctly. Hmm...

louisgrasset commented 7 months ago

By installing the NPM deps, i wouldn't be surprised it's installing the right one automatically

QuinnyPig commented 7 months ago

This is what worked for me; I'm unsure whether the flag I removed is going to cause issues for other folks though, as I don't fully grasp why it was needed in the first place.

Separately, I shot you a DM on Twitter.

louisgrasset commented 7 months ago

It sounds to be still working on amd64, let me know on arm side 👍🏻

QuinnyPig commented 7 months ago

Confirmed; working here without any tweaks.