Skip to content

Specify platform as $TARGETPLATFORM in Dockerfile FROM statements

Dmytro Makovey requested to merge 563-enforce-platform into master

What does this MR do?

Adds --platform=$TARGETPLATFORM to all FROM statements in Dockerfiles to ensure we always use corresponding platform's image during build to avoid cross-contamination. This is done in preparation for !1425 (merged).

From past trial-and-error, despite stated default behaviour we've experienced buildx pulling in the "wrong arch" image resulting in broken pipelines. This is the enforcing measure to make it 100% that any pulled image within the build is of the same arch as the one we're building. Since introduction of that measure issues with platform mismatch have disappeared. So we're "working around" the issue with the builder/registry that we've already encountered and protecting ourselves from any future similar issues.

Related issues

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow

Expected (please provide an explanation if not completing)

Edited by Mitchell Nielsen

Merge request reports