From ec4e59191c34691dd59fab71974b533f5938c3a5 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 08:39:30 +0000 Subject: [PATCH 01/17] added a docker file for nginx static server for serving terraform binary zip --- .github/workflows/build-push-release.yml | 26 +++++++++++++++++++ containers/terraform-static-server/Dockerfile | 14 ++++++++++ 2 files changed, 40 insertions(+) create mode 100644 containers/terraform-static-server/Dockerfile diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 6abda12..07b58fb 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -8,8 +8,34 @@ on: workflow_dispatch: jobs: + build-push-terraform-static-server: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Login to Github Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push Terraform static server image + uses: docker/build-push-action@v2 + with: + context: containers/terraform-static-server + push: true + tags: ghcr.io/terrariumcloud/terraform-static-server:latest + build-push: runs-on: ubuntu-latest + needs: [build-push-terraform-static-server] + steps: - name: Checkout Code uses: actions/checkout@v2 diff --git a/containers/terraform-static-server/Dockerfile b/containers/terraform-static-server/Dockerfile new file mode 100644 index 0000000..77e445f --- /dev/null +++ b/containers/terraform-static-server/Dockerfile @@ -0,0 +1,14 @@ +FROM nginx:latest + +# Set working directory to the Nginx document root +WORKDIR /usr/share/nginx/html + +# Download the Terraform binary zip file, clean up and reduce the size of the Docker image by removing unnecessary files after installing packages. +RUN apt-get update && apt-get install -y curl && \ + curl -O https://releases.hashicorp.com/terraform/1.4.7/terraform_1.4.7_linux_amd64.zip && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +EXPOSE 3000 + +# Start the NGINX server +CMD ["nginx", "-g", "daemon off;"] From 79ea9bc6d499577099ec0ad465202e1aaa0d50af Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 08:47:21 +0000 Subject: [PATCH 02/17] updated versions in github workflows actions --- .github/workflows/build-push-release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 07b58fb..eefd8e3 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -13,20 +13,20 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to Github Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Build and push Terraform static server image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: containers/terraform-static-server push: true @@ -38,17 +38,17 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to Github Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Bump version and push tag id: tag_version @@ -57,7 +57,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . push: true From 56b4605ac6c0e5747b919657f04ea4b0e2c78231 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 09:18:16 +0000 Subject: [PATCH 03/17] update release action version --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index eefd8e3..a8495e1 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -65,7 +65,7 @@ jobs: build-args: "BUILD_INFO_VERSION=${{ steps.tag_version.outputs.new_tag }}" - name: Create a GitHub release - uses: 3rd-Party-Actions/release-action@v1 + uses: 3rd-Party-Actions/release-action@v2 with: tag: ${{ steps.tag_version.outputs.new_tag }} name: Release ${{ steps.tag_version.outputs.new_tag }} From 7bec06d97cceee0a469beba70ab16ed85566a24d Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 13:06:52 +0000 Subject: [PATCH 04/17] removed expose port as we will define the container port as a part of k8s manifest --- containers/terraform-static-server/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/containers/terraform-static-server/Dockerfile b/containers/terraform-static-server/Dockerfile index 77e445f..ba1bf0b 100644 --- a/containers/terraform-static-server/Dockerfile +++ b/containers/terraform-static-server/Dockerfile @@ -8,7 +8,5 @@ RUN apt-get update && apt-get install -y curl && \ curl -O https://releases.hashicorp.com/terraform/1.4.7/terraform_1.4.7_linux_amd64.zip && \ apt-get clean && rm -rf /var/lib/apt/lists/* -EXPOSE 3000 - # Start the NGINX server CMD ["nginx", "-g", "daemon off;"] From b3ad27e03607922eceeb5850242f9a3148ff6eef Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 13:10:03 +0000 Subject: [PATCH 05/17] renamed terraform-static-server to nginx-static-server as it more relevant. --- .github/workflows/build-push-release.yml | 8 ++++---- .../Dockerfile | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename containers/{terraform-static-server => nginx-static-server}/Dockerfile (100%) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index a8495e1..d449b19 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - build-push-terraform-static-server: + build-push-nginx-static-server: runs-on: ubuntu-latest steps: @@ -28,13 +28,13 @@ jobs: - name: Build and push Terraform static server image uses: docker/build-push-action@v3 with: - context: containers/terraform-static-server + context: containers/nginx-static-server push: true - tags: ghcr.io/terrariumcloud/terraform-static-server:latest + tags: ghcr.io/terrariumcloud/nginx-static-server:latest build-push: runs-on: ubuntu-latest - needs: [build-push-terraform-static-server] + needs: [build-push-nginx-static-server] steps: - name: Checkout Code diff --git a/containers/terraform-static-server/Dockerfile b/containers/nginx-static-server/Dockerfile similarity index 100% rename from containers/terraform-static-server/Dockerfile rename to containers/nginx-static-server/Dockerfile From 557584b7521258e6d41f5893a1ff36baae1f3999 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 13:33:40 +0000 Subject: [PATCH 06/17] updated release actions --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index d449b19..76b5bcb 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -65,7 +65,7 @@ jobs: build-args: "BUILD_INFO_VERSION=${{ steps.tag_version.outputs.new_tag }}" - name: Create a GitHub release - uses: 3rd-Party-Actions/release-action@v2 + uses: elgohr/Github-Release-Action@v5 with: tag: ${{ steps.tag_version.outputs.new_tag }} name: Release ${{ steps.tag_version.outputs.new_tag }} From 289bdadc1809805ca3387121bbe96698fef085a8 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Wed, 26 Jun 2024 13:35:53 +0000 Subject: [PATCH 07/17] revert release actions version --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 76b5bcb..06fa865 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -65,7 +65,7 @@ jobs: build-args: "BUILD_INFO_VERSION=${{ steps.tag_version.outputs.new_tag }}" - name: Create a GitHub release - uses: elgohr/Github-Release-Action@v5 + uses: 3rd-Party-Actions/release-action@v1 with: tag: ${{ steps.tag_version.outputs.new_tag }} name: Release ${{ steps.tag_version.outputs.new_tag }} From 499b6bd6339062b3cbb8710791c0a328bc588c74 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:41:27 +0530 Subject: [PATCH 08/17] Update actions/checkout to v4 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 06fa865..9d2e9a4 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to Github Container Registry uses: docker/login-action@v2 From 99766428ef943db70eb6dbc280854039be79d302 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:41:51 +0530 Subject: [PATCH 09/17] Update actions/checkout to v4 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 9d2e9a4..ebd395f 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to Github Container Registry uses: docker/login-action@v2 From 728b11850a1e273e8f2b1c91c2a02086f10e2ad3 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:42:14 +0530 Subject: [PATCH 10/17] Update docker/login-action to v3 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index ebd395f..63cc2aa 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@v4 - name: Login to Github Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} From fb9f6c797f2d4a5b60113958b7966a6e653fe566 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:42:34 +0530 Subject: [PATCH 11/17] Update docker/login-action to v3 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 63cc2aa..7cbb126 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v4 - name: Login to Github Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} From edfc1e1401c3d06afb8157e17f3e837ef0a6d7a5 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:42:58 +0530 Subject: [PATCH 12/17] Update docker/setup-buildx-action to v3 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 7cbb126..98199f7 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -48,7 +48,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Bump version and push tag id: tag_version From ca5242fac46b2071b8298a0db241be6a9452d9c3 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:43:15 +0530 Subject: [PATCH 13/17] Update docker/setup-buildx-action to v3 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 98199f7..4c23ded 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -23,7 +23,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build and push Terraform static server image uses: docker/build-push-action@v3 From a5d8cecb2b385c67d0ee2e1a93b848f5c3aaaf82 Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:43:37 +0530 Subject: [PATCH 14/17] Update docker/build-push-action to v6 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 4c23ded..3ed39e6 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -26,7 +26,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build and push Terraform static server image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: containers/nginx-static-server push: true From 75cd1ffa8f0f6e3bef2c6eb9163be5851325d3ab Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava <55885026+anjanikshree12@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:43:54 +0530 Subject: [PATCH 15/17] Update docker/build-push-action to v6 Co-authored-by: Adam Charrett <73886859+adcharre@users.noreply.github.com> --- .github/workflows/build-push-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index 3ed39e6..edc5d47 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -57,7 +57,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: . push: true From 699a317d514af1f1f1c18b321697848eb8c0b74b Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Thu, 27 Jun 2024 02:37:58 +0000 Subject: [PATCH 16/17] updated the terraform binary zip path --- containers/nginx-static-server/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/containers/nginx-static-server/Dockerfile b/containers/nginx-static-server/Dockerfile index ba1bf0b..94bd689 100644 --- a/containers/nginx-static-server/Dockerfile +++ b/containers/nginx-static-server/Dockerfile @@ -5,7 +5,8 @@ WORKDIR /usr/share/nginx/html # Download the Terraform binary zip file, clean up and reduce the size of the Docker image by removing unnecessary files after installing packages. RUN apt-get update && apt-get install -y curl && \ - curl -O https://releases.hashicorp.com/terraform/1.4.7/terraform_1.4.7_linux_amd64.zip && \ + mkdir -p terraform/1.4.7 && \ + curl -o terraform/1.4.7/terraform_1.4.7_linux_amd64.zip https://releases.hashicorp.com/terraform/1.4.7/terraform_1.4.7_linux_amd64.zip && \ apt-get clean && rm -rf /var/lib/apt/lists/* # Start the NGINX server From 0a3f81e2d16b16e6f78fa1a8d8d3e9009b5c906f Mon Sep 17 00:00:00 2001 From: Anjani Kumar Srivastava Date: Thu, 27 Jun 2024 07:22:34 +0000 Subject: [PATCH 17/17] updated release and tag actions --- .github/workflows/build-push-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index edc5d47..451e9a7 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -52,7 +52,7 @@ jobs: - name: Bump version and push tag id: tag_version - uses: 3rd-Party-Actions/github-tag-action@v6.0 + uses: mathieudutour/github-tag-action@v6.2 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -65,7 +65,7 @@ jobs: build-args: "BUILD_INFO_VERSION=${{ steps.tag_version.outputs.new_tag }}" - name: Create a GitHub release - uses: 3rd-Party-Actions/release-action@v1 + uses: ncipollo/release-action@v1 with: tag: ${{ steps.tag_version.outputs.new_tag }} name: Release ${{ steps.tag_version.outputs.new_tag }}