From 976a1d147c89afe5525aff2e1ec687fa31a898d9 Mon Sep 17 00:00:00 2001 From: Martin Reinhardt Date: Mon, 7 Nov 2022 07:19:44 +0100 Subject: [PATCH 1/2] chore: Update Packer and setup qemu --- .github/workflows/build.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f11348d..3fb1b03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,11 @@ jobs: name: Building base image runs-on: ubuntu-latest steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - uses: actions/checkout@v4 - name: Set up Python @@ -22,9 +27,9 @@ jobs: - name: Set up packer and dependencies run: | - wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg - echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list - sudo apt update && sudo apt install packer + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - + sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" + sudo apt-get update && sudo apt-get install packer packer init .pkr.hcl pip install -r requirements.txt From 4c6fa63e24d0ae6f18be3837a5e6898a9bc68111 Mon Sep 17 00:00:00 2001 From: Martin Reinhardt Date: Mon, 7 Nov 2022 07:27:02 +0100 Subject: [PATCH 2/2] feat(ARM): Adding ARM Platform on packer --- docker/_base/build.pkr.hcl | 23 ++++++++++++++++++----- docker/java/openjdk11.pkr.hcl | 21 +++++++++++++++------ docker/java/openjdk17.pkr.hcl | 21 +++++++++++++++------ docker/kube/kube.pkr.hcl | 21 +++++++++++++++------ docker/nodejs/nodejs.pkr.hcl | 21 +++++++++++++++------ docker/terraform/terraform.pkr.hcl | 21 +++++++++++++++------ 6 files changed, 93 insertions(+), 35 deletions(-) diff --git a/docker/_base/build.pkr.hcl b/docker/_base/build.pkr.hcl index ac8d5d4..929f59f 100644 --- a/docker/_base/build.pkr.hcl +++ b/docker/_base/build.pkr.hcl @@ -1,17 +1,30 @@ +source "docker" "amd64" { + changes = [ + "VOLUME /data", + "WORKDIR /data", + "ENTRYPOINT /bin/bash" + ] + commit = true + image = "buildpack-deps:bookworm" + pull = true + platform = "linux/amd64" +} + -source "docker" "autogenerated_1" { +source "docker" "arm64" { changes = [ "VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash" ] - commit = true - image = "buildpack-deps:bookworm" - pull = true + commit = true + image = "buildpack-deps:bookworm" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.arm64"] provisioner "ansible" { playbook_file = "ansible/playbook.yml" diff --git a/docker/java/openjdk11.pkr.hcl b/docker/java/openjdk11.pkr.hcl index 3e491f2..ccb817e 100644 --- a/docker/java/openjdk11.pkr.hcl +++ b/docker/java/openjdk11.pkr.hcl @@ -4,15 +4,24 @@ variable "image_tag" { default = env("IMAGE_TAG") } -source "docker" "autogenerated_1" { - changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] - commit = true - image = "toolisticon/base-builder-image" - pull = true +source "docker" "amd64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/amd64" +} + +source "docker" "arm64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.arm64"] provisioner "ansible" { playbook_file = "ansible/openjdk11.yml" diff --git a/docker/java/openjdk17.pkr.hcl b/docker/java/openjdk17.pkr.hcl index d78d704..d85e770 100644 --- a/docker/java/openjdk17.pkr.hcl +++ b/docker/java/openjdk17.pkr.hcl @@ -4,15 +4,24 @@ variable "image_tag" { default = env("IMAGE_TAG") } -source "docker" "autogenerated_1" { - changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] - commit = true - image = "toolisticon/base-builder-image" - pull = true +source "docker" "amd64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/amd64" +} + +source "docker" "arm64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.arm64"] provisioner "ansible" { playbook_file = "ansible/openjdk17.yml" diff --git a/docker/kube/kube.pkr.hcl b/docker/kube/kube.pkr.hcl index 0ba2ab8..318035d 100644 --- a/docker/kube/kube.pkr.hcl +++ b/docker/kube/kube.pkr.hcl @@ -4,15 +4,24 @@ variable "image_tag" { default = env("IMAGE_TAG") } -source "docker" "autogenerated_1" { - changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] - commit = true - image = "toolisticon/base-builder-image" - pull = true +source "docker" "amd64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/amd64" +} + +source "docker" "arm64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.amd64"] provisioner "ansible" { playbook_file = "ansible/playbook.yml" diff --git a/docker/nodejs/nodejs.pkr.hcl b/docker/nodejs/nodejs.pkr.hcl index b342925..94b5401 100644 --- a/docker/nodejs/nodejs.pkr.hcl +++ b/docker/nodejs/nodejs.pkr.hcl @@ -4,15 +4,24 @@ variable "image_tag" { default = env("IMAGE_TAG") } -source "docker" "autogenerated_1" { - changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] - commit = true - image = "toolisticon/base-builder-image" - pull = true +source "docker" "amd64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/amd64" +} + +source "docker" "arm64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.arm64"] provisioner "ansible" { playbook_file = "ansible/playbook.yml" diff --git a/docker/terraform/terraform.pkr.hcl b/docker/terraform/terraform.pkr.hcl index 5ce3099..27486cf 100644 --- a/docker/terraform/terraform.pkr.hcl +++ b/docker/terraform/terraform.pkr.hcl @@ -4,15 +4,24 @@ variable "image_tag" { default = env("IMAGE_TAG") } -source "docker" "autogenerated_1" { - changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] - commit = true - image = "toolisticon/base-builder-image" - pull = true +source "docker" "amd64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/amd64" +} + +source "docker" "arm64" { + changes = ["VOLUME /data", "WORKDIR /data", "ENTRYPOINT /bin/bash"] + commit = true + image = "toolisticon/base-builder-image" + pull = true + platform = "linux/arm64" } build { - sources = ["source.docker.autogenerated_1"] + sources = ["source.docker.amd64", "source.docker.arm64"] provisioner "ansible" { playbook_file = "ansible/playbook.yml"