Skip to content

Commit

Permalink
[CIEDEV-3991][Bundle Authoring]: Create static container image with t…
Browse files Browse the repository at this point in the history
…erraform binaries (#78)

* added a docker file for nginx static server for serving terraform binary zip

* updated versions in github workflows actions

* update release action version

* removed expose port as we will define the container port as a part of k8s manifest

* renamed terraform-static-server to nginx-static-server as it more relevant.

* updated release actions

* revert release actions version

* Update actions/checkout to v4

Co-authored-by: Adam Charrett <[email protected]>

* Update actions/checkout to v4

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/login-action to v3

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/login-action to v3

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/setup-buildx-action to v3

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/setup-buildx-action to v3

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/build-push-action to v6

Co-authored-by: Adam Charrett <[email protected]>

* Update docker/build-push-action to v6

Co-authored-by: Adam Charrett <[email protected]>

* updated the terraform binary zip path

* updated release and tag actions

---------

Co-authored-by: Anjani Kumar Srivastava <[email protected]>
Co-authored-by: Adam Charrett <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2024
1 parent 1a360e9 commit 43cdc1c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/build-push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,64 @@ on:
workflow_dispatch:

jobs:
build-push-nginx-static-server:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Terraform static server image
uses: docker/build-push-action@v6
with:
context: containers/nginx-static-server
push: true
tags: ghcr.io/terrariumcloud/nginx-static-server:latest

build-push:
runs-on: ubuntu-latest
needs: [build-push-nginx-static-server]

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Login to Github Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
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@v3

- 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 }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/terrariumcloud/terrarium:latest,ghcr.io/terrariumcloud/terrarium:${{ steps.tag_version.outputs.new_tag }}
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 }}
Expand Down
13 changes: 13 additions & 0 deletions containers/nginx-static-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 && \
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
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 43cdc1c

Please sign in to comment.