Update .gitlab-ci.yaml and commands/build.sh for conversion to multi-architecture images (AddInventoryFrontend)
From LibreFoodPantry/client-solutions/theas-pantry&9 (closed):
Convert all Docker images we are building to multi-architecture images Docker images built on Intel/AMD architectures will not run on ARM architectures (which include Apple M1/M2).
While we can probably control the architecture that we run production systems on, developers will be using different architectures when running our images locally. We can solve this by building multi-architecture Docker images.
Here is an article for reference: https://itnext.io/multi-arch-docker-images-in-gitlab-container-registry-ada46cc6d4bb
To do this, the .gitlab-ci.yaml file for the pipeline and the commands/build.sh in each project that builds a Docker image (meaning backend and frontend projects) needs to be updated with variables to enable multi-platform builds. This documentation file outlines what needs to be done: https://gitlab.com/LibreFoodPantry/common-services/tools/documentation/-/blob/main/source/multi-platform.md
-
1. The new PIPELINE_IMAGE_PLATFORMS variable must be added to .gitlab-ci.yaml and set to the the values shown. -
2. commands/build.sh will need to be modified. Probably the contents of the file can just be replaced with the example in the docs file. The LOCAL_IMAGE_NAME will have to be set according to the project name.
See https://gitlab.com/LibreFoodPantry/common-services/tools/swagger-cli for a recently converted example.