Looking for someone who knows about building docker images for arm64 and amd64 to review this PR

https://github.com/fiatjaf/narr/pull/3

If this is good then I can continue working on package nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6 narr app for Umbrel and start9

Reply to this note

Please Login to reply.

Discussion

afk but typically you dont need a Dockerfile per arch

I this case I did though because I need some additional dependencies for the arm64 build, and I had to pass a few extra flags to the go build command to make it happy :)

You could probably use the TARGETARCH arg to conditionally install it.

Something like this might work:

RUN [ "$TARGETARCH" != "arm64" ] || apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu

Another strategy is to have both platforms defined in the same Dockerfile and then use the BUILDARCH and TARGETARCH arguments to select the correct one. That's what I'm doing for the Helipad Dockerfile: https://github.com/Podcastindex-org/helipad/blob/main/Dockerfile

In my experience with C and .net applications specifying base images without an arch will cause docker to pull the correct image for the arch and you can let the compiler infer the platform, but I have no idea how well go handles that.

I also notice many go applications are distroless, I'm not how important what commands you are running in your final image are and if you can eliminate them, the image can be quite small if you do, like 7-10mb usually.

TIL. x86_64 and amd64 are basically the same thing.

I’m still really new with docker but I’ve done a lot with it over the last few weeks so I’ll try and have a look shortly and see if I can be helpful.

I tested your image and gave some feedback

Thanks, although I cant zap you 😞