Skip to content

Commit

Permalink
feat: Add Terragrunt runner image (#51)
Browse files Browse the repository at this point in the history
* Create docker image for terragrunt runner

* Wrap up terragunt container
  • Loading branch information
simonrondelez authored Jun 12, 2024
1 parent 50249b2 commit b7d4904
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish-terragrunt-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Terragrunt Image

on:
push:
paths:
- "terragrunt/**"
- ".github/workflows/publish-terragrunt-image.yml"
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/terragrunt

jobs:
build-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU #emulation support with QEMU to be able to build against more platforms.
uses: docker/setup-qemu-action@v3
- 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 the container to GitHub Container Registry using the latest tag
uses: docker/build-push-action@v5.3.0
with:
context: .
file: terragrunt/Dockerfile
platforms: |
linux/amd64
linux/arm64
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
push: true
provenance: false
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ This is a Docker image for [Teleport](https://gravitational.com/teleport/)

This will build a Teleport image from the Debian base image. This Dockerfile expects the released Teleport binaries in `teleport/teleport` folder.

## Terragrunt

This is a Docker image that contains all the tools needed to run Terragrunt in Skyscrapers:

* [AWS CLI](https://aws.amazon.com/cli/)
* [Helm](https://helm.sh/)
* [Kubectl](https://kubernetes.io/docs/reference/kubectl/overview/)
* [OpenTofu](https://github.com/opentofu/opentofu)
* [Sops](https://github.com/mozilla/sops)
* [Terragrunt](https://terragrunt.gruntwork.io/)

## volume-populator

This container is used to populate volumes from configmaps. Useful in Kubernetes as an init container to populate a volume with data before the application starts.
Expand Down
48 changes: 48 additions & 0 deletions terragrunt/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Versions
ARG ALPINE_VERSION=3.20
ARG TOFU_VERSION=1.6.2
ARG SOPS_VERSION=v3.8.1

FROM ghcr.io/getsops/sops:${SOPS_VERSION}-alpine as sops
FROM ghcr.io/opentofu/opentofu:${TOFU_VERSION} as tofu

FROM alpine:${ALPINE_VERSION} as build

ARG TARGETARCH=arm64
ARG TERRAGRUNT_VERSION=v0.58.6
ARG KUBECTL_VERSION=v1.30.0
ARG HELM_VERSION=v3.15.1

RUN apk update && \
apk add curl ca-certificates

RUN curl -L \
https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 -o terragrunt && \
chmod +x terragrunt && \
mv terragrunt /usr/local/bin/
RUN terragrunt --version

RUN curl -L -o kubectl https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && \
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl.sha256" && \
echo "$(cat kubectl.sha256) kubectl" | sha256sum -c && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl

RUN curl -LO https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
curl -LO https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz.sha256sum && \
sha256sum -c helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz.sha256sum && \
tar -xvzf helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
chmod +x linux-${TARGETARCH}/helm && \
mv linux-${TARGETARCH}/helm /usr/local/bin/helm

FROM alpine:${ALPINE_VERSION}

RUN apk update && \
apk add aws-cli jq yq-go git
RUN aws --version

COPY --from=sops /usr/local/bin/sops /usr/local/bin/sops
COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu
COPY --from=build /usr/local/bin/terragrunt /usr/local/bin/terragrunt
COPY --from=build /usr/local/bin/kubectl /usr/local/bin/kubectl
COPY --from=build /usr/local/bin/helm /usr/local/bin/helm

0 comments on commit b7d4904

Please sign in to comment.