Skip to content

containerscrew/infratools

Repository files navigation

infratools logo

infratools

A batteries-included container image for infrastructure work — OpenTofu, Terragrunt, kubectl, Helm, AWS CLI and more.
Use it in CI/CD pipelines or as a portable local dev shell.

Docker Pulls Full image size CI image size Latest version License Last commit


Table of contents

Why infratools?

Setting up kubectl, helm, aws-cli, terragrunt and friends on every laptop and CI runner is tedious and drifts over time. infratools packages a curated, version-pinned set of infra tools into a single OCI image you can pull from anywhere.

  • Two flavors — a lightweight -ci image for pipelines, and a full local shell with zsh, krew, fzf, and dev ergonomics.
  • Multi-arch — published for both amd64 and arm64.
  • Pinned versions — every tool version is declared in the Dockerfile and bumped through conventional commits.

Supported architectures

Architecture Supported Tested
amd64
arm64

What's inside

Tool Full image CI image
kubectl
helm
aws-cli
jq / curl
opentofu
terragrunt
tfenv
krew + oidc-login
kubectx
git / vim
zsh + oh-my-zsh
fzf, bash, make
pre-commit
docker-cli
openssh (krb5)

Note

Exact pinned versions live in the Dockerfile under the ARG declarations.


Quick start

Warning

Avoid using :latest in real workflows. Tool versions (OpenTofu, Terragrunt, kubectl, Helm…) change between releases and may break compatibility with your modules or state files. Pin an explicit version from Docker Hub tags or GitHub releases — for example containerscrew/infratools:3.3.1. The :latest tags in the snippets below are shown for brevity only.

Mount your project directory and your local AWS / kube / SSH config so the container can act on your real environment:

docker run -it --rm \
  --name infratools \
  -h infratools \
  -v "$(pwd):/code" \
  -v "$HOME/.aws:/home/infratools/.aws" \
  -v "$HOME/.kube:/home/infratools/.kube" \
  -v "$HOME/.ssh:/home/infratools/.ssh" \
  -w /code \
  containerscrew/infratools:latest

Tip

For day-to-day local use, prefer the run-infratools.sh helper — it wires up these mounts (plus env-file and zsh history persistence) automatically.

Or use the image directly in a pipeline:

deploy:
  image: containerscrew/infratools:latest-ci
  script:
    - kubectl version --client
    - helm version
    - aws --version

Image flavors

Full image

containerscrew/infratools:<version> — the complete toolbox for local development and rich pipelines. Includes OpenTofu, Terragrunt, zsh with oh-my-zsh, krew plugins, and the rest of the table above.

CI image

containerscrew/infratools:<version>-ci — a stripped-down image built from the same Dockerfile (--target ci). It ships only what most deploy jobs need: kubectl, helm, aws-cli, jq, curl. No terraform, no zsh, no dev tooling — smaller and faster to pull.

Both flavors are published from the same git tag.


The run-infratools.sh helper

For local use, copy run-infratools.sh into your repo (or your $PATH) and run it:

./run-infratools.sh
# Usage: run-infratools.sh [-i (info)] [-u (update)] [-a (attach or create)] [-v <host_path>:<container_path>]

Install it globally so you can reuse it from any repo:

sudo cp run-infratools.sh /usr/local/bin/

Mount additional files (e.g. credentials):

run-infratools.sh -a -v ~/.lacework.toml:/home/infratools/.lacework.toml

Persist environment variables across container runs — create a .user/env file in your project:

cd your-terraform-repo
mkdir -p .user
echo "FOO=BAR" >> .user/env
run-infratools.sh -a
echo "$FOO"   # → BAR

Important

The helper persists zsh history in .zsh_container_history at the repo root and reads .user/env as an env file. Add both to your .gitignore to keep them out of version control.


Pipeline examples

GitLab CI with the full image:

stages:
  - deploy

infratools:
  image: containerscrew/infratools:latest
  stage: deploy
  script:
    - tofu init
    - tofu plan

GitLab CI with the slim CI image:

deploy:
  image: containerscrew/infratools:latest-ci
  stage: deploy
  script:
    - kubectl apply -f manifests/
    - helm upgrade --install my-release ./chart

Tip

Pin to an explicit version (:3.3.1 / :3.3.1-ci) in production pipelines for reproducible builds.


Working with Terraform vs OpenTofu

Important

Since v2.9.0, terraform has been replaced by opentofu — a drop-in CLI replacement. terragrunt will auto-detect the tofu binary.

If you still need the classic terraform CLI, tfenv is included:

tfenv use 1.9.5

# Apple Silicon hosts wanting the amd64 binary:
TFENV_ARCH=amd64 tfenv use 1.9.5

# Point terragrunt explicitly at terraform:
terragrunt init --tf-path=/usr/local/bin/terraform
# or via env var:
export TG_TF_PATH=/usr/local/bin/terraform
terragrunt plan

Self-signed git servers

When pulling modules from a private git server with a self-signed certificate, configure ~/.gitconfig:

[http "https://gitlab.server.internal"]
  sslCAInfo = /path/to/your/certificate.crt
  sslVerify = true

Or, inside the container, skip TLS verification (use with care):

git config --global http.sslVerify false

Local development

Build and run the full image locally:

make local-build-run

Build and run the CI image locally:

make ci-local-build-run

Scan the image with Trivy:

make trivy-scan

Releases & versioning

Releases are managed with cocogitto and conventional commits.

# Record commits
cog commit feat -a "add new tool X"
cog commit fix  -a "update kubectl version"

# Bump and tag (updates CHANGELOG.md and creates the git tag)
cog bump --version 3.2.0
git push origin main --follow-tags

Pushing the tag triggers release.yml, which builds and publishes both flavors:

  • containerscrew/infratools:3.2.0 — full image
  • containerscrew/infratools:3.2.0-ci — CI image

Note

Starting in 3.0.0, tags no longer carry the leading v (e.g. 3.2.0, not v3.2.0).


Changelog

Starting in 3.0.0, CHANGELOG.md is generated from conventional commits via cocogitto.


License

infratools is distributed under the terms of the Apache 2.0 license.

About

Container image with infra tools (terraform, tofu, aws cli, helm, kubectl...). Useful for CI/CD.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors