netlify / build-image

This is the build image used for running automated builds
MIT License
497 stars 196 forks source link

chore: make build-image arm64 compatible #818

Closed lukasholzer closed 2 years ago

lukasholzer commented 2 years ago

๐ŸŽ‰ Thanks for submitting a pull request! ๐ŸŽ‰

Summary

Trying to make the image build for arm64 as well


For us to review and ship your PR efficiently, please perform the following steps:

A picture of a cute animal (not mandatory, but encouraged)

lukasholzer commented 2 years ago

Seems to be hitting a wall with homebrew and the arm64 support: image

Without homebrew it works already that's the last missing piece

danez commented 2 years ago

This makes this obsolete, at least the part about apple silicon https://github.com/netlify/build-image/pull/813

lukasholzer commented 2 years ago

The image will now build on the local M1 arm Macbook without ease.

Next step will be another issue where we are building for both platforms inside the CI as well (but I want to keep the PRs small)

Basically we need to do:

docker buildx create --use

docker buildx build \
  --tag=docker.io/<< parameters.image-name >>:${SHA1_IMAGE_TAG} \
  --tag=docker.io/<< parameters.image-name >>:${BRANCH_IMAGE_TAG} \
  --build-arg NF_IMAGE_VERSION=${CIRCLE_SHA1} \
  --build-arg NF_IMAGE_TAG=${VERSION_TAG} \
  --target << parameters.build-target >> <<# parameters.squash >> --squash <</ parameters.squash >> \
  --platform linux/amd64,linux/arm64 \
  .

But this is not working as there are still issues to cross compile wkhtmltoPdf for a different arch:

CleanShot 2022-07-14 at 16 58 57

lukasholzer commented 2 years ago

Implemented the Hadolint from this issue here as well: https://github.com/netlify/build-image/issues/815