From 28604cf5b129d3db3b441bd0f811e5c653a09f1b Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 19 Mar 2024 14:54:18 -0700 Subject: [PATCH 1/3] BF: Explicitly build for the linux platform. This resolves situations where you are building this (for example) on a mac M1 machine, which builds images that can't be run in linux. --- cloudknot/templates/Dockerfile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudknot/templates/Dockerfile.template b/cloudknot/templates/Dockerfile.template index 22b0f86..ee2d9d9 100644 --- a/cloudknot/templates/Dockerfile.template +++ b/cloudknot/templates/Dockerfile.template @@ -4,7 +4,7 @@ ############################################################################### # Use official python base image -FROM ${base_image} +FROM --platform=linux/amd64 ${base_image} # Install python dependencies COPY requirements.txt /tmp/ From 6603aca7f705acb4d24e72f67c55270e616c8b04 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 19 Mar 2024 15:04:50 -0700 Subject: [PATCH 2/3] Try to invert the order of things. --- cloudknot/templates/Dockerfile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudknot/templates/Dockerfile.template b/cloudknot/templates/Dockerfile.template index ee2d9d9..24ad63c 100644 --- a/cloudknot/templates/Dockerfile.template +++ b/cloudknot/templates/Dockerfile.template @@ -4,7 +4,7 @@ ############################################################################### # Use official python base image -FROM --platform=linux/amd64 ${base_image} +FROM ${base_image} --platform=linux/amd64 # Install python dependencies COPY requirements.txt /tmp/ From b8f7eb13944304535cffc1c093fd0c0042f8948e Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 19 Mar 2024 15:45:43 -0700 Subject: [PATCH 3/3] Use the docker API to set the target platform. Instead of using the template for this. --- cloudknot/dockerimage.py | 1 + cloudknot/templates/Dockerfile.template | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudknot/dockerimage.py b/cloudknot/dockerimage.py index 3b06b9d..9d0c3ca 100644 --- a/cloudknot/dockerimage.py +++ b/cloudknot/dockerimage.py @@ -696,6 +696,7 @@ def build(self, tags, image_name=None, nocache=False): rm=True, forcerm=True, nocache=nocache, + platform="linux/amd64", ) # Update the config file images list diff --git a/cloudknot/templates/Dockerfile.template b/cloudknot/templates/Dockerfile.template index 24ad63c..22b0f86 100644 --- a/cloudknot/templates/Dockerfile.template +++ b/cloudknot/templates/Dockerfile.template @@ -4,7 +4,7 @@ ############################################################################### # Use official python base image -FROM ${base_image} --platform=linux/amd64 +FROM ${base_image} # Install python dependencies COPY requirements.txt /tmp/