From a81d770360d69c3feeb92394df1b4fd504a6b5fd Mon Sep 17 00:00:00 2001 From: Amir Malka Date: Tue, 15 Nov 2022 10:57:29 +0200 Subject: [PATCH 1/2] fixed docker build to support arm --- .github/workflows/build.yaml | 2 +- .github/workflows/build_dev.yaml | 2 +- build.py | 2 +- build/Dockerfile | 2 +- httphandler/build.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 75dc8051bc..fa099f2415 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -86,6 +86,6 @@ jobs: client: "image-release" image_name: "quay.io/${{ github.repository_owner }}/kubescape" image_tag: "v2.0.${{ github.run_number }}" - support_platforms: false + support_platforms: true cosign: true secrets: inherit diff --git a/.github/workflows/build_dev.yaml b/.github/workflows/build_dev.yaml index be9acb3415..18f501540b 100644 --- a/.github/workflows/build_dev.yaml +++ b/.github/workflows/build_dev.yaml @@ -21,6 +21,6 @@ jobs: client: "image-dev" image_name: "quay.io/${{ github.repository_owner }}/kubescape" image_tag: "dev-v2.0.${{ github.run_number }}" - support_platforms: false + support_platforms: true cosign: true secrets: inherit diff --git a/build.py b/build.py index c33291126a..9ddd46bcf2 100644 --- a/build.py +++ b/build.py @@ -57,7 +57,7 @@ def main(): if client_name: ldflags += " -X {}={}".format(client_var, client_name) - build_command = ["go", "build", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags] + build_command = ["go", "build", "-buildmode=pie", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags] print("Building kubescape and saving here: {}".format(ks_file)) print("Build command: {}".format(" ".join(build_command))) diff --git a/build/Dockerfile b/build/Dockerfile index 8b5c144b3b..360efa76aa 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -12,7 +12,7 @@ ENV CGO_ENABLED=1 # Install required python/pip ENV PYTHONUNBUFFERED=1 -RUN apk add --update --no-cache python3 git openssl-dev musl-dev gcc make cmake pkgconfig && ln -sf python3 /usr/bin/python +RUN apk add --update --no-cache python3 gcc make git libc-dev binutils-gold cmake pkgconfig && ln -sf python3 /usr/bin/python RUN python3 -m ensurepip RUN pip3 install --no-cache --upgrade pip setuptools diff --git a/httphandler/build.py b/httphandler/build.py index ee516c1cf0..795e561724 100644 --- a/httphandler/build.py +++ b/httphandler/build.py @@ -56,7 +56,7 @@ def main(): if client_name: ldflags += " -X {}={}".format(client_var, client_name) - build_command = ["go", "build", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags] + build_command = ["go", "build", "-buildmode=pie", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags] print("Building kubescape and saving here: {}".format(ks_file)) print("Build command: {}".format(" ".join(build_command))) From c0d7f51d6c6b0d9aa2a7c54486691b7c2e0c2f9b Mon Sep 17 00:00:00 2001 From: Amir Malka Date: Tue, 15 Nov 2022 11:27:00 +0200 Subject: [PATCH 2/2] test build flow