From 1a5795a9459bbf3acda908a079bdad022de4053e Mon Sep 17 00:00:00 2001 From: Charro Gruver Date: Tue, 4 Feb 2025 18:38:36 +0000 Subject: [PATCH 1/2] Add docs for using podman farm to build multi-arch images Signed-off-by: Charro Gruver --- CONTRIBUTING.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c1c61116..8d9dc82f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,6 +94,70 @@ To build RamaLama's manpages, you can run `make docs`. Built documentation will be placed in the `docs/` directory. Markdown versions can be viewed in the `docs/` directory. +### Setting up Podman Farm to build Multi-Arch Images + +Some of the RamaLama images are intended to run on aarch64 as well as x86_64, e.g. `ramalama` & `vulkan`. + +Podman Farm is a great tool for building multi-arch image manifests. Docs here - [Podman Farm](https://docs.podman.io/en/latest/markdown/podman-farm.1.html) + +To set up `podman farm` you need to first have `podman` installed on systems with the desired build architectures. + +1. Start the podman socket listener on all systems. + + ```bash + systemctl enable podman --now + ``` + +1. Create an `ssh` trust between your workstation and the other systems: + + ```bash + ssh-copy-id @ + ``` + +1. Create a podman farm: + + ```bash + podman farm create + ``` + +1. Create a podman system connection to the remote host and add it to the podman farm: + + ```bash + podman system connection add @ + podman farm update --add + ``` + + __Note:__ use the same that you used for the SSH trust. + +1. Once you have added all of the desired connections to your podman farm, you can now build a multi-arch image. + + ```bash + podman login + podman farm build -t / -f path/to/Containerfile ./path/ + ``` + +Example using an Apple Silicon based machine as the workstation, and an Intel Linux machine as a remote host with IP 10.11.12.13: + +1. Set up Podman Farm - + + ```bash + ssh-copy-id root@10.11.12.13 + podman machine init -m 8192 # Give the machine plenty of RAM + podman machine start + podman farm create ramalama + podman farm update ramalama --add podman-machine-default # Add the local podman system to the farm + podman system connection add x86_64 root@10.11.12.13 # Add a podman system connection to the remote host + podman farm update ramalama --add x86_64 # Add the remote host to the farm + ``` +1. Build a multi-arch image + + ```bash + git clone https://github.com/containers/ramalama.git + cd ramalama + podman login quay.io + podman farm build -t quay.io//ramalama/vulkan -f container-images/vulkan/Containerfile ./container-images + ``` + ## Testing RamaLama provides an extensive suite of regression tests in the `test/` directory. From aea3e176840628499ee246f1d1c05fb59c2302f0 Mon Sep 17 00:00:00 2001 From: Charro Gruver Date: Tue, 4 Feb 2025 19:01:35 +0000 Subject: [PATCH 2/2] incorporate Sourcery-AI suggestions Signed-off-by: Charro Gruver --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d9dc82f..0145c757 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,7 +96,7 @@ Markdown versions can be viewed in the `docs/` directory. ### Setting up Podman Farm to build Multi-Arch Images -Some of the RamaLama images are intended to run on aarch64 as well as x86_64, e.g. `ramalama` & `vulkan`. +Some of the RamaLama images are intended to run on aarch64 as well as x86_64, e.g., `ramalama` & `vulkan`. Podman Farm is a great tool for building multi-arch image manifests. Docs here - [Podman Farm](https://docs.podman.io/en/latest/markdown/podman-farm.1.html) @@ -127,7 +127,7 @@ To set up `podman farm` you need to first have `podman` installed on systems wit podman farm update --add ``` - __Note:__ use the same that you used for the SSH trust. + __Note:__ use the same for the connection that you used to set up the SSH trust. 1. Once you have added all of the desired connections to your podman farm, you can now build a multi-arch image. @@ -141,12 +141,12 @@ Example using an Apple Silicon based machine as the workstation, and an Intel Li 1. Set up Podman Farm - ```bash - ssh-copy-id root@10.11.12.13 + ssh-copy-id @10.11.12.13 podman machine init -m 8192 # Give the machine plenty of RAM podman machine start podman farm create ramalama podman farm update ramalama --add podman-machine-default # Add the local podman system to the farm - podman system connection add x86_64 root@10.11.12.13 # Add a podman system connection to the remote host + podman system connection add x86_64 @10.11.12.13 # Add a podman system connection to the remote host podman farm update ramalama --add x86_64 # Add the remote host to the farm ``` 1. Build a multi-arch image