Wikidepia/InstaFix

[devops] Cross-compile to, and add aarch64 support in Docker images

linuxct opened this issue · 5 comments

In order to run the application in ARM 64-bit hardware, such as Raspberry Pi's or Mac M-series processors, it needs to be cross-compiled using GOARCH=arm64.

To do this, a go build needs to be ran for both x86_64 (default/current arch) and arm64.
Both binaries need to be kept with separate names, thus the x86_64 can remain as /app/instafix, and the arm binary as /app/instafix-arm.
Then, instead of running the application directly as an entrypoint, it will need to be ran from an entrypoint script that chooses between both available binaries depending on the running device's architecture.
Bonus points if the entrypoint shell script also includes a health check reporting back to the Docker engine.

I will be submitting a PR for this later on, as so far I have kept a separate fork that allows me to run ARM-only Docker images of instafix, and I would like to get rid of that since it's troublesome to keep up to date with (your) upstream.