proud-art-41399
02/14/2022, 4:07 PMextra_options
supplied to DockerBuild
, e.g.
image = docker.Image(
"image-arm64",
build=docker.DockerBuild(
context="..",
extra_options=[
"--platform=linux/arm64",
"--output=type=docker",
"--cache-from=type=local,src=/tmp/.buildx-cache",
"--cache-to=type=local,mode=max,dest=/tmp/.buildx-cache",
],
),
image_name=repository.repository_url.apply(lambda url: f"{url}:arm64"),
registry=registry,
skip_push=False,
)
The first problem is that I can only build image for one architecture a time and can't use multiple values for --platform
(e.g. --platform=linux/amd64,linux/arm64
) because:
• I have to use the docker
output type as Pulumi uses docker inspect
after building the image (https://github.com/pulumi/pulumi-docker/blob/e2a25c62efc553515e784c0b241a2c946c888dd7/sdk/python/pulumi_docker/docker.py#L441).
• The docker
export type currently doesn't support multi-arch images (https://docs.docker.com/engine/reference/commandline/buildx_build/).
Even if I build images for distinct platforms separately, I'd need a way to create and push the manifest list (https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-multi-architecture-image.html). There's no such resource in the Docker provider, though.
For the motivation. I have a web app deployed as an ECS service running on AWS Fargate with autoscaling. I want to use a mix of Fargate and Fargate Spot, for tasks running on Fargate I'd like to use ARM64 architecture however Fargate Spot currently only supports x86-64 (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html).