Request : support --platform tag in build.json tags


Source of request : addons builds fail when building from multi-arch base images

  • Request1: allowing the “–platform” tag in the build.json file would allow to reference each relevant platform, which would then be passed to the Dockerfile through the “$BUILD_FROM” tag. I’ve added the relevant documentation at the bottom of the post

  • Issue2 : a REGEX is applied and does not allow the “–platform” characters in the build.json

Can't parse /data/addons/git/db21ed7f/addons_updater/build.json: does not match regular expression ^([a-zA-Z\-\.:\d{}]+/)*?([\-\w{}]+)/([\-\w{}]+)(:[\.\-\w{}]+)?$ for dictionary value @ data['build_from']['aarch64']. Got '--platform=linux/arm64 homeassistant/aarch64-base-python:3.9-alpine3.13'
  • Request2 : would it be possible to allow the platform tag in the REGEX?

Thank you

“–platform” tag : The optional --platform flag can be used to specify the platform of the image in case FROM references a multi-platform image. For example, linux/amd64, linux/arm64, or windows/amd64. By default, the target platform of the build request is used. Global build arguments can be used in the value of this flag, for example automatic platform ARGs allow you to force a stage to native build platform (--platform=$BUILDPLATFORM), and use it to cross-compile to the target platform inside the stage. (Dockerfile reference | Docker Documentation)