blumeops/mise-tasks/container-list
Erich Blume 29faa5d207 Rewrite container-tag-and-release as typer CLI with dry-run support
Port from bash to uv run --script with typer. Default behavior now
builds both variants (dockerfile + nix) when both exist. Add --nix and
--dockerfile flags to release only one variant, and --dry-run to preview
without creating tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 07:54:49 -08:00

61 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
#MISE description="List available containers and their recent tags"
set -euo pipefail
REGISTRY="registry.ops.eblu.me"
CONTAINER_DIR="containers"
echo "Container Images"
echo "================"
echo ""
# Find all container directories with Dockerfiles or default.nix
for dir in "$CONTAINER_DIR"/*/; do
[[ -d "$dir" ]] || continue
# Determine available build types
has_dockerfile=false
has_nix=false
[[ -f "$dir/Dockerfile" ]] && has_dockerfile=true
[[ -f "$dir/default.nix" ]] && has_nix=true
# Skip directories with no build files
$has_dockerfile || $has_nix || continue
# Build type label
types=()
$has_dockerfile && types+=("dockerfile")
$has_nix && types+=("nix")
label=$(IFS=+; echo "${types[*]}")
# Extract container name from directory
container=$(basename "$dir")
image="blumeops/$container"
echo "[$label] $container"
echo " Image: $REGISTRY/$image"
echo " Path: $dir"
# Query zot for recent tags
tags=$(curl -sf "https://$REGISTRY/v2/$image/tags/list" 2>/dev/null | jq -r '.tags // [] | .[]' | grep -E '^v[0-9]' | sort -V | tail -4 || true)
if [[ -n "$tags" ]]; then
echo " Recent tags:"
echo "$tags" | while read -r tag; do
echo " - $tag"
done
else
echo " Recent tags: (none)"
fi
echo ""
done
echo "---"
echo "To release a new version (builds all available types by default):"
echo " mise run container-tag-and-release <container> <version>"
echo " mise run container-tag-and-release <container> <version> --nix # nix only"
echo " mise run container-tag-and-release <container> <version> --dockerfile # dockerfile only"
echo ""
echo "Example:"
echo " mise run container-tag-and-release nettest v1.0.0"