From b8f48df03201a31fcd3885cd659552c8abca93a6 Mon Sep 17 00:00:00 2001 From: az Date: Thu, 15 Jan 2026 08:31:55 -0600 Subject: [PATCH 1/3] test: add pre-installed packages to Docker image --- .github/workflows/test-docker-image.yaml | 93 ++++++++++++++++++++++++ Dockerfile | 40 ++++++++++ 2 files changed, 133 insertions(+) create mode 100644 .github/workflows/test-docker-image.yaml diff --git a/.github/workflows/test-docker-image.yaml b/.github/workflows/test-docker-image.yaml new file mode 100644 index 0000000..9bcade3 --- /dev/null +++ b/.github/workflows/test-docker-image.yaml @@ -0,0 +1,93 @@ +name: Test Docker Image Build + +on: + workflow_dispatch: + pull_request: + paths: + - 'Dockerfile' + - '.github/workflows/test-docker-image.yaml' + +jobs: + build-test-image: + name: Build Test Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set lowercase owner + run: echo "OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push test image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64 + push: true + tags: | + ghcr.io/${{ env.OWNER }}/github-runner:test + ghcr.io/${{ env.OWNER }}/github-runner:test-${{ github.sha }} + + verify-tools: + name: Verify Pre-installed Tools + needs: build-test-image + runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository_owner }}/github-runner:test + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Verify Atmos installation + run: | + echo "Checking Atmos..." + atmos version + which atmos + + - name: Verify Terraform installation + run: | + echo "Checking Terraform..." + terraform version + which terraform + + - name: Verify tfcmt installation + run: | + echo "Checking tfcmt..." + tfcmt --version + which tfcmt + + - name: Verify terraform-docs installation + run: | + echo "Checking terraform-docs..." + terraform-docs --version + which terraform-docs + + - name: Verify all tools are in PATH + run: | + echo "All tools verified successfully!" + echo "✅ Atmos: $(atmos version | head -n 1)" + echo "✅ Terraform: $(terraform version | head -n 1)" + echo "✅ tfcmt: $(tfcmt --version)" + echo "✅ terraform-docs: $(terraform-docs --version)" + + - name: Summary + if: success() + run: | + echo "🎉 All pre-installed tools are working correctly!" + echo "The Docker image is ready to use and will avoid GitHub API rate limits." diff --git a/Dockerfile b/Dockerfile index cecfa2f..73f3eec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,46 @@ RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zi && sudo ./aws/install \ && sudo rm -rf aws awscliv2.zip +# Install workflow tools to avoid GitHub API rate limits during execution +# All tools are installed in a single layer to minimize image size +RUN set -eux; \ + ARCH="$(uname -m)"; \ + case "$ARCH" in \ + x86_64) ARCH='amd64' ;; \ + aarch64) ARCH='arm64' ;; \ + *) echo "Unsupported architecture: $ARCH"; exit 1 ;; \ + esac; \ + \ + # Install Atmos CLI v1.195.0 + echo "Installing Atmos CLI v1.195.0..."; \ + curl -fsSL "https://github.com/cloudposse/atmos/releases/download/v1.195.0/atmos_1.195.0_linux_${ARCH}" -o /tmp/atmos && \ + sudo install -m 755 /tmp/atmos /usr/local/bin/atmos && \ + rm /tmp/atmos && \ + atmos version && \ + \ + # Install Terraform (latest stable - 1.10.4) + echo "Installing Terraform v1.10.4..."; \ + curl -fsSL "https://releases.hashicorp.com/terraform/1.10.4/terraform_1.10.4_linux_${ARCH}.zip" -o /tmp/terraform.zip && \ + sudo unzip -q /tmp/terraform.zip -d /usr/local/bin/ && \ + rm /tmp/terraform.zip && \ + terraform version && \ + \ + # Install tfcmt v4.14.0 + echo "Installing tfcmt v4.14.0..."; \ + curl -fsSL "https://github.com/suzuki-shunsuke/tfcmt/releases/download/v4.14.0/tfcmt_linux_${ARCH}.tar.gz" -o /tmp/tfcmt.tar.gz && \ + sudo tar -xzf /tmp/tfcmt.tar.gz -C /usr/local/bin/ tfcmt && \ + rm /tmp/tfcmt.tar.gz && \ + tfcmt --version && \ + \ + # Install terraform-docs v0.18.0 + echo "Installing terraform-docs v0.18.0..."; \ + curl -fsSL "https://github.com/terraform-docs/terraform-docs/releases/download/v0.18.0/terraform-docs-v0.18.0-linux-${ARCH}.tar.gz" -o /tmp/terraform-docs.tar.gz && \ + sudo tar -xzf /tmp/terraform-docs.tar.gz -C /usr/local/bin/ terraform-docs && \ + rm /tmp/terraform-docs.tar.gz && \ + terraform-docs --version && \ + \ + echo "All tools installed successfully!" + RUN mkdir -p ~/.ssh && \ ssh-keyscan github.com >> ~/.ssh/known_hosts From 39061b9166f62db317ab8df63b9e53e018369c80 Mon Sep 17 00:00:00 2001 From: az Date: Thu, 15 Jan 2026 08:38:30 -0600 Subject: [PATCH 2/3] fix: simplify test workflow to avoid runner queue issues --- .github/workflows/test-docker-image.yaml | 61 ++++++++++-------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/.github/workflows/test-docker-image.yaml b/.github/workflows/test-docker-image.yaml index 9bcade3..7ba0487 100644 --- a/.github/workflows/test-docker-image.yaml +++ b/.github/workflows/test-docker-image.yaml @@ -47,47 +47,36 @@ jobs: name: Verify Pre-installed Tools needs: build-test-image runs-on: ubuntu-latest - container: - image: ghcr.io/${{ github.repository_owner }}/github-runner:test - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Verify Atmos installation - run: | - echo "Checking Atmos..." - atmos version - which atmos + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Verify Terraform installation + - name: Pull and verify test image run: | + # Pull the test image + docker pull ghcr.io/${{ github.repository_owner }}/github-runner:test + + # Verify Atmos + echo "Checking Atmos..." + docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test atmos version + + # Verify Terraform echo "Checking Terraform..." - terraform version - which terraform - - - name: Verify tfcmt installation - run: | + docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test terraform version + + # Verify tfcmt echo "Checking tfcmt..." - tfcmt --version - which tfcmt - - - name: Verify terraform-docs installation - run: | + docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test tfcmt --version + + # Verify terraform-docs echo "Checking terraform-docs..." - terraform-docs --version - which terraform-docs - - - name: Verify all tools are in PATH - run: | - echo "All tools verified successfully!" - echo "✅ Atmos: $(atmos version | head -n 1)" - echo "✅ Terraform: $(terraform version | head -n 1)" - echo "✅ tfcmt: $(tfcmt --version)" - echo "✅ terraform-docs: $(terraform-docs --version)" - - - name: Summary - if: success() - run: | - echo "🎉 All pre-installed tools are working correctly!" + docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test terraform-docs --version + + # Summary + echo "✅ All tools verified successfully!" echo "The Docker image is ready to use and will avoid GitHub API rate limits." From 5228c02cb5c1681387fc5a6b531d7501dfd027c9 Mon Sep 17 00:00:00 2001 From: az Date: Thu, 15 Jan 2026 09:22:03 -0600 Subject: [PATCH 3/3] fix: use lowercase owner for Docker image references --- .github/workflows/test-docker-image.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-docker-image.yaml b/.github/workflows/test-docker-image.yaml index 7ba0487..952ad93 100644 --- a/.github/workflows/test-docker-image.yaml +++ b/.github/workflows/test-docker-image.yaml @@ -49,6 +49,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Set lowercase owner + run: echo "OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -59,23 +62,23 @@ jobs: - name: Pull and verify test image run: | # Pull the test image - docker pull ghcr.io/${{ github.repository_owner }}/github-runner:test + docker pull ghcr.io/${{ env.OWNER }}/github-runner:test # Verify Atmos echo "Checking Atmos..." - docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test atmos version + docker run --rm ghcr.io/${{ env.OWNER }}/github-runner:test atmos version # Verify Terraform echo "Checking Terraform..." - docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test terraform version + docker run --rm ghcr.io/${{ env.OWNER }}/github-runner:test terraform version # Verify tfcmt echo "Checking tfcmt..." - docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test tfcmt --version + docker run --rm ghcr.io/${{ env.OWNER }}/github-runner:test tfcmt --version # Verify terraform-docs echo "Checking terraform-docs..." - docker run --rm ghcr.io/${{ github.repository_owner }}/github-runner:test terraform-docs --version + docker run --rm ghcr.io/${{ env.OWNER }}/github-runner:test terraform-docs --version # Summary echo "✅ All tools verified successfully!"