Recommended procedure for cross-platform setup with non-balena base images

Hi there,

I have successfully set up a multi container project where containers communicate via AMQP messaging. To achieve this, im am currently using a broker via the official arm32v7/rabbitmq image. This image is part of my docker-compose setup. Now I want to leverage the Dockerfile.template mechanism to make my project architecture independent. The application containers are based on balenalib base images, so I can use placeholders for the target platform (‘raspberrypi3’, for example) - everything fine so far.

But how do I proceed with the rabbitmq image? It is not part of balenalib and does not conform to the device type and architecture naming standards from balena. I would need to distinguish between arm32v7/rabbitmq and amd64/rabbitmq, for example.

Solutions I have in mind:

  1. Push the official images into my private registry and rename them to sth. like raspberrypi3-rabbitmq, armv7h-rabbitmq, or amd64-rabbitmq etc.
  2. Create a rabbitmq image from an balenalib/alpine base image and build rabbitmq on top.
  3. Create two or more architecture specific project referring to the official rabbitmq images.

Any suggestions for an elegant solution are welcome.

Kind regards
Bruno

Hi,
You could also use the Dockerfile.<devicetype | arch> mechanism (https://www.balena.io/docs/learn/deploy/deployment/#project-resolutions). So you could use the architecture specific rabbitmq image.

For example you could have a rabbitmq folder, with a
Dockerfile.amd64 with the content:

FROM amd64/rabbitmq

and

Dockerfile.armv7hf with the conent:

FROM armv7hf/rabbitmq

This is a list of our supported device types with the matching architecture.

I hope I understood the problem and this is a viable solution.

Best regards,

Yes! I had not seen this mechanism.

Thanks a lot.

Well…
It seems I am missing something. I set up Dockerfile.amd64 and Dockerfile.armv7hf in my rabbitmq/ subfolder, but if I balena push, balena picks up the amd64 Dockerfile although my project is raspberry3 based.

Any idea?

Edit: please ignore my reply, I had a typo in my Dockerfiles. It seems to work now. Thanks!

Good to hear that it works @bvetter : )