First, install podman and buildah. These tools support running containers build for other architectures like arm64 and ppc64le.
Next, create a Dockerfile
, e.g.:
FROM ppc64le/golang:1.20.7-alpine
ADD kubernetes /kubernetes
Note that this dockerfile is for ppc64le, so can't be run directly with docker on an amd64 linux machine.
But it can be run using buldah:
buildah bud -f Dockerfile -t cross-arch-example .
container=$(buildah from cross-arch-example)
# use the container for whatever you need, e.g. to run a test:
buildah run $container -- sh -c 'cd /kubernetes/staging/src/k8s.io/apiextensions-apiserver && go test -v -timeout 30s -run ^TestCostEstimation/extended_library_replace$ ./pkg/apiserver/schema/cel'