From 48ad49b5e3077c16a17cbd8227c2de2940fea21e Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Thu, 4 Jul 2024 14:40:42 +0200 Subject: [PATCH 1/5] multiarch build demonstrated locally --- Makefile | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 4c62a78..88a4085 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,18 @@ DLV_VERSION=v1.21.2 -TAG=$(DLV_VERSION) +TAG=$(DLV_VERSION)-debug1 + +ARCHS=linux/arm64,linux/amd64 MIN_IMAGE=oklischat/delve:$(TAG) SUMO_IMAGE=oklischat/delve-sumo:$(TAG) -build-min: - docker build --target minimal --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(MIN_IMAGE) . - -build-sumo: - docker build --target sumo --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(SUMO_IMAGE) . - -build-all: build-min build-sumo +# build targets also --push because just --load'ing them into Docker isn't directly supported currently -- https://github.com/docker/buildx/issues/59 -push-min: build-min - docker push $(MIN_IMAGE) +build-push-min: + docker buildx build --push --platform $(ARCHS) --target minimal --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(MIN_IMAGE) . -push-sumo: build-sumo - docker push $(SUMO_IMAGE) +build-push-sumo: + docker buildx build --push --platform $(ARCHS) --target sumo --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(SUMO_IMAGE) . -push: push-min push-sumo +build-push-all: build-push-min build-push-sumo From 4cb2e5526e843ae6309d8040a93e91a8f7b29dcc Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Thu, 4 Jul 2024 15:13:20 +0200 Subject: [PATCH 2/5] CI adapted --- .github/workflows/cicd.yaml | 8 +++++++- Makefile | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 882438d..cb38f03 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -10,6 +10,12 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Log in to Docker Hub uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 @@ -18,4 +24,4 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: push - run: make push + run: make build-push-all diff --git a/Makefile b/Makefile index 88a4085..72a995f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DLV_VERSION=v1.21.2 -TAG=$(DLV_VERSION)-debug1 +TAG=$(DLV_VERSION)-multiarch-debug ARCHS=linux/arm64,linux/amd64 From 6ad6fd6120dffeb089352d693babe7a189f9f2ef Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Thu, 4 Jul 2024 15:25:58 +0200 Subject: [PATCH 3/5] README updated --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0d430b8..61a1e05 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Source: https://github.com/multi-io/docker-delve +Image: https://hub.docker.com/r/oklischat/delve + Usually run with the binary to be debugged mounted into the container. You could also copy the dlv binary (which is linked statically) out of the container into the to-be-debugged container, e.g. if you use this image in a K8s @@ -28,3 +30,6 @@ docker run --security-opt seccomp:unconfined -v `pwd`/output:/output -p 2345:234 You should now be able to connect any debugging client running on the host (e.g delve itself, or an IDE like Goland) to the debugged process at `localhost:2345`. + +The images are multi-arch, currently linux/amd64 and linux/arm64. Docker will +automatically choose the one matching the local system. From d337995f7d341cb7de3c4c7f57f79dfa488eb1af Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Thu, 4 Jul 2024 15:26:18 +0200 Subject: [PATCH 4/5] CI only on master branch --- .github/workflows/cicd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index cb38f03..9221786 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -1,7 +1,7 @@ name: Publish docker image on: push: - pull_request: + branches: master jobs: publish: From 301e7221da16a55eb83d0ea8b2072cfaeb07b996 Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Thu, 4 Jul 2024 15:26:58 +0200 Subject: [PATCH 5/5] back to original tag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 72a995f..adb1eef 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DLV_VERSION=v1.21.2 -TAG=$(DLV_VERSION)-multiarch-debug +TAG=$(DLV_VERSION) ARCHS=linux/arm64,linux/amd64