Excerpt
Try
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
DOCKER_DEFAULT_PLATFORM=linux/amd64 \
docker-compose build
DOCKER_BUILDKIT
Enable (1) or disable (0) BuildKit builds
DOCKER_DEFAULT_PLATFORM
Set the default platform for commands that take the --platform flag
COMPOSE_DOCKER_CLI_BUILD
Configure whether to use the Compose built-in python client (0) for building images or the native docker cli (1). By default, Compose uses the docker CLI to perform builds, which allows you to use BuildKit to perform builds.
Try
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
DOCKER_DEFAULT_PLATFORM=linux/amd64 \
docker-compose build
DOCKER_BUILDKIT
Enable (1) or disable (0) BuildKit builds
DOCKER_DEFAULT_PLATFORM
Set the default platform for commands that take the --platform flag
COMPOSE_DOCKER_CLI_BUILD
Configure whether to use the Compose built-in python client (0) for building images or the native docker cli (1). By default, Compose uses the docker CLI to perform builds, which allows you to use BuildKit to perform builds.