I want to automate the creation of a docker image for a rust api ( https://github.com/megametres/recettes-total ) based on rocket for a raspberry pi.
I tried various way of doing it and had quite my load of issues... I finally suceed of doing it, but my solution is ugly, In order to make my build passes, I have to build twice.
So I am using https://github.com/rust-embedded/cross and in order for my solution to be portable, I create one container in which I installed cross, let say compiler image. Now my build requires ssl and postgres so inspired by https://github.com/rust-embedded/cross/issues/410 I create another image that contains the native openssl and postgres compiled in, let say native image.
As for openssl, everything works fine, but in order to get my build passes, I have to run the build with the native image that does not contains the x86_64 lib of postgres. it fails and after that I run the build with the native image that contains the x86_64 lib of postgres and now it passes.
Here is my code:
Dockerfile for the compiler image: https://github.com/megametres/recettes-total/blob/develop/docker/cross-armv7/Dockerfile-cross-runner
Dockerfile for the cross image: https://github.com/megametres/recettes-total/blob/develop/docker/cross-armv7/Dockerfile
The script that builds my armv7 binary: https://github.com/megametres/recettes-total/blob/develop/docker/cross-armv7/build-armv7.sh
After that I use the created binary with docker buildx to create the armv7 image.
So if anyone could give me some insight on why that happens, and maybe find a way to do that properly would make my day
Have a good one yourself!