Specify platform as $TARGETPLATFORM in Dockerfile FROM statements
What does this MR do?
Adds --platform=$TARGETPLATFORM
to all FROM
statements in Dockerfile
s 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
- Closes #563 (closed)
- Relates to gitlab-org/distribution/team-tasks#1142 (closed)
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)
-
Test plan indicating conditions for success has been posted and passes (see !1425 (merged), !1455 (comment 1504884481)) -
Documentation created/updated -
Integration tests added to GitLab QA -
The impact any change in container size has should be evaluated -
New dependencies are managed with dependencies.io