p2panda / aquadoggo

Node for the p2panda network handling validation, storage, aggregation and replication
GNU Affero General Public License v3.0
69 stars 5 forks source link

Dockerfile that fetches existing built releases for multi-platform build #588

Closed jadehopepunk closed 9 months ago

jadehopepunk commented 10 months ago

This is mainly a draft for discussion at this stage. This dockerfile works, and fast, even if it's an unholy abomination. Particular limitations are:

To use it, you need to use docker buildx. On my linux box, that's done by:

docker buildx build --platform linux/amd64,linux/arm/v7 -t redbugcollective/aquadoggo:latest --push .

I've tried pulling and running that image on linux x86, and on a physical Raspberry Pi, and it works.

So, to build this with github actions, we're going to need to set it up using the steps at https://docs.docker.com/build/ci/github-actions/multi-platform/

How are you feeling about this approach?

📋 Checklist

sandreae commented 10 months ago

Hi @jadehopepunk, thanks for this PR :+1:

Can you remind me how you ended up with this approach? As I remember, it was because compile times for some targets were getting too long.

I don't hate this approach, positives are that it re-uses existing compiled binaries, and it's quick, but of course it is an unusual beast ;-p

It's been a while since I did any serious docker work, but another approach I can see is to have a two step docker build process:

I would guess this gets around any slow build times you were seeing, our ci build times for different platforms are quite quick: https://github.com/p2panda/aquadoggo/actions/runs/6039734188/usage