I have a C app whose executable I would like to run in a Docker container on an ARM-based Raspberry Pi.
Ideally, as part of creating the Docker image on my Windows laptop I would like to build the app from source, targetted of course for the Pi. But despite using a base image of arm32v7:latest for the image, gcc builds it for x86 (and I tried several other images).
I know there are clunky workarounds, such as pre-building the app natively on the Pi and copying the executable into the Docker image during the latter’s build, or deferring the app build until the image starts running on the Pi as a container. But it seems more efficient and elegant to pre-build it in the image if possible.
Any ideas? Is there a recommended Docker pattern/practice for this?
- o -
P.S. I just asked the same question on devops.stackexchange, but unfortunately it ended up so long I doubt if anyone will bother reading it there.