spotfiresoftware / spotfire-cloud-deployment-kit

Vanilla recipes to build container images and Helm charts for Spotfire®
Apache License 2.0
18 stars 15 forks source link

Build images on arm machines #20

Open DeBr4nd opened 7 months ago

DeBr4nd commented 7 months ago

Hi, I would like to suggest a change to the makefile in the /containers folder.

The way the file is written, when you build images on an ARM instruction set machine, such as a Mac with an Apple silicon processor (e.g. M3 Pro) the docker engine aligns and tends to download versions you applications on an arm64 basis (e.g. when apt-get install -y --no-install-recommends openjdk-17-jre-headless happens).

Doing so creates 2 problems:

That is why it is worth adding these lines to the Makefile:

ARCH_TARGET ?= linux/amd64

$(IMAGE_TARGETS) :
    $(DOCKER_CLI) buildx build $(BUILD_ARGS) --platform $(ARCH_TARGET) --tag $(BUILD_TAG_ARGUMENT) $(IMAGES_DIR)/$(@) --load

This way we force docker/podman to use x86 instructions instead of arm instructions.

I solved the problem this way. I hope I was helpful.

Max

mjohanss-tibco commented 2 months ago

Hi, good suggestion. I'll see if we can add this to the Makefile.

paulboone commented 1 month ago

@DeBr4nd's modifications worked fine for me.