I Put 130+ DevSecOps Tools in One Container So You Don’t Have To (And Lived to Tell the Tale)

 

The Problem Every DevSecOps Engineer Knows Too Well

🎯 The Idea: One Container to Rule Them All

Press enter or click to view image in full size

πŸ”️ Why Alpine? (Or: How I Learned to Love Minimalism)

# dockerfile
FROM alpine:3.20

# That's it. That's the base. 5MB of pure minimalist beauty.
## dockerfile

# Install base utilities - this took longer than I'd like to admit
RUN apk add --no-cache \
bash \
curl \
wget \
git \
jq \
vim \
# ... and about 30 more carefully chosen tools

πŸ› ️ Building the Toolbox: Where Things Got Interesting

Stage 1: The Kubernetes Essentials

# dockerfile
# Install kubectl - latest version, dynamically fetched
RUN KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) && \
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
## dockerfile
# kubectx and kubens - because typing is overrated
RUN KUBECTX_VERSION=$(curl -s https://api.github.com/repos/ahmetb/kubectx/releases/latest | \
sed -n 's/.*"tag_name": "v\([0-9.]*\)".*/\1/p') && \
wget https://github.com/ahmetb/kubectx/releases/download/v${KUBECTX_VERSION}/kubectx_v${KUBECTX_VERSION}_linux_x86_64.tar.gz && \
tar -xzvf kubectx*.tar.gz && \
mv kubectx /usr/local/bin/ && \
rm kubectx*.tar.gz
Press enter or click to view image in full size

Stage 2: The Security Battalion

## dockerfile

# Trivy - because vulnerabilities don't scan themselves
RUN TRIVY_VERSION=$(curl -s https://api.github.com/repos/aquasecurity/trivy/releases/latest | \
sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p') && \
curl -LO "https://github.com/aquasecurity/trivy/releases/download/${TRIVY_VERSION}/trivy_${TRIVY_VERSION#v}_Linux-64bit.tar.gz" && \
tar -xvzf trivy*.tar.gz -C /usr/local/bin && \
rm trivy*.tar.gz

# Kubescape - CNCF's gift to security teams
RUN curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash

# Grype, Syft, Docker Scout... the gang's all here

Stage 3: Infrastructure as Code (Or: The Terraform Saga)

## dockerfile

RUN TF_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | \
jq -r .current_version | sed 's/^v//') && \
wget "https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip" && \
unzip terraform.zip && \
mv terraform /usr/local/bin/ && \
rm terraform.zip
# OpenTofu - because open source matters
RUN OPENTOFU_VERSION=$(curl -s https://api.github.com/repos/opentofu/opentofu/releases/latest | \
grep tag_name | cut -d '"' -f 4 | sed 's/^v//') && \
wget "https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_linux_amd64.zip" && \
unzip tofu.zip && \
mv tofu /usr/local/bin/ && \
rm tofu.zip

πŸ› The Debugging Chronicles: A Comedy in Three Acts

Press enter or click to view image in full size

Act 1: The BusyBox Awakening

RUN grep -P "something" file.txt
# grep: invalid option -- P

Act 2: The gzip Mystery

RUN tar -xzf tool.tar.gz
# gzip: invalid magic
# dockerfile
RUN wget --tries=3 --timeout=30 https://example.com/tool.tar.gz && \
sha256sum tool.tar.gz # Verify it's not cursed

Act 3: The GitHub API Null Saga

TOOL_VERSION=$(curl -s https://api.github.com/repos/owner/tool/releases/latest | jq -r .tag_name)
# Version: null
# Use cached version as fallback
RUN TOOL_VERSION=$(curl -s https://api.github.com/repos/owner/tool/releases/latest | \
jq -r .tag_name || echo "v1.0.0") && \
# ... rest of installation
## Also, building at 3 AM when API rates reset helps. Not that I did that. Multiple times## 🎨 The Final Touches: Organization is EverythingHere's a secret: **the organization matters more than the tools.**I split the Dockerfile into 20+ logical stages:
```
STAGE 1: Environment Setup
STAGE 2: Base System Packages
STAGE 3: Networking & Diagnostics
STAGE 4: Programming Languages
STAGE 5: Cloud CLI Tools
STAGE 6: Container & Orchestration
STAGE 7: Kubectl Plugins
STAGE 8: Infrastructure as Code
STAGE 9: Service Mesh Tools
STAGE 10: GitOps & CI/CD
...and 11 more

################################################################################
# STAGE 6: CONTAINER & ORCHESTRATION TOOLS
################################################################################
# Purpose: Everything you need to build, run, and manage containers
# Includes: Docker CLI, kubectl, helm, k9s, kind
################################################################################

The Developer Experience Layer

# lazygit - because Git UIs are nice actually
# bat - cat but with syntax highlighting and line numbers
# fzf - fuzzy finder that will change your life
# httpie - curl's friendlier cousin
Press enter or click to view image in full size

🎁 The Big Reveal: What’s Actually In This Thing?

πŸ”— Want to Try It Yourself?


# Clone the repo
git clone [GITHUB LINK HERE]
# Build it (automated with security scans)
./build.sh
# Run it
docker-compose run --rm devsecops bash
# Marvel at your new superpowers
kubectl version
terraform version
trivy --version
# ... try all 130+ tools!

πŸŽ“ What I Learned (Besides Patience)

1. Dynamic Version Fetching is Worth It

2. Organization Beats Cleverness

3. Constraints Make You Better

4. Documentation is a Love Letter to Future You

5. Developer Experience Matters

Press enter or click to view image in full size

πŸš€ What’s Next?

🎬 The TL;DR

Comments

Popular posts from this blog

24 AWS Architecture Blueprints for Building Scalable Cloud Systems