Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM alpine:3.21

LABEL org.opencontainers.image.source="https://github.com/SovereignCloudStack/cluster-stacks"
LABEL org.opencontainers.image.description="Cluster Stack Build Tools"
LABEL org.opencontainers.image.licenses="Apache-2.0"

# Install system dependencies
RUN apk add --no-cache \
bash \
git \
curl \
tar \
gzip \
gawk \
python3 \
py3-yaml \
jq \
ca-certificates

# Install helm
RUN HELM_VERSION=v3.17.3 && \
curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" | \
tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm

# Install yq (mikefarah)
RUN YQ_VERSION=v4.45.4 && \
curl -fsSL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
-o /usr/local/bin/yq && chmod +x /usr/local/bin/yq

# Install oras
RUN ORAS_VERSION=1.2.2 && \
curl -fsSL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" | \
tar -xz -C /usr/local/bin oras

# Install just
RUN JUST_VERSION=1.40.0 && \
curl -fsSL "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" | \
tar -xz -C /usr/local/bin just

WORKDIR /workspace

# Verify installations
RUN bash --version | head -1 && \
helm version --short && \
yq --version && \
oras version && \
just --version && \
git --version

# Allow git operations inside mounted volumes
RUN git config --global --add safe.directory /workspace

CMD ["/bin/bash"]
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
description = "Cluster Stacks - Build tools for SCS Kubernetes cluster stacks";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
name = "cluster-stacks-dev";

buildInputs = with pkgs; [
# Core tools
bash
git
curl

# Container tools
docker
podman

# Kubernetes tools
kubectl
kubernetes-helm
kind
kustomize

# Build tools
just
python3
python3Packages.pyyaml
jq
yq-go

# OCI/Registry tools
oras
];

shellHook = ''
echo "Cluster Stacks development environment"
echo ""
echo "Available tools:"
echo " just - Run 'just --list' to see available commands"
echo " helm - Kubernetes package manager"
echo " kubectl - Kubernetes CLI"
echo " kind - Local Kubernetes clusters"
echo " yq - YAML processor"
echo " oras - OCI registry client"
echo " python3 - With PyYAML"
echo ""

# Generate shell completions into a cache directory
comp_dir="''${XDG_CACHE_HOME:-$HOME/.cache}/cluster-stacks/completions"
mkdir -p "$comp_dir"

user_shell=$(getent passwd "$(whoami)" 2>/dev/null | cut -d: -f7)
shell_name=$(basename "''${user_shell:-bash}")

# Regenerate completions if the directory is empty or tools were updated
if [ ! -f "$comp_dir/.$shell_name-generated" ]; then
kubectl completion "$shell_name" > "$comp_dir/_kubectl" 2>/dev/null || true
helm completion "$shell_name" > "$comp_dir/_helm" 2>/dev/null || true
just --completions "$shell_name" > "$comp_dir/_just" 2>/dev/null || true
kind completion "$shell_name" > "$comp_dir/_kind" 2>/dev/null || true
oras completion "$shell_name" > "$comp_dir/_oras" 2>/dev/null || true
touch "$comp_dir/.$shell_name-generated"
fi

# Make completions available
export FPATH="$comp_dir:$FPATH"

# Start user's preferred shell instead of bash.
# nix develop always drops into bash; this detects the user's
# real login shell from /etc/passwd and exec's into it.
if [ -n "$user_shell" ] && [ "$shell_name" != "bash" ] && [ -x "$user_shell" ]; then
exec "$user_shell"
fi
'';
};
}
);
}
Loading