docker-dotnet/Makefile
Mathias Beaulieu-Duncan 0b301121ad Initial commit: multi-version .NET Docker images with apko base
- apko configs for runtime (ICU), runtime-invariant (no ICU), and SDK variants
- Build workflow with dynamic matrix from .NET release metadata (EOL-aware)
- Daily update-check workflow to detect new .NET versions
- Docker Scout PR analysis workflow
- LTS/STS floating tags, multi-arch (amd64 + arm64)
- Makefile for local builds and version discovery

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:18:15 -05:00

56 lines
2.0 KiB
Makefile

DOCKER_IMAGE := svrnty/dotnet
VARIANTS := runtime runtime-invariant sdk
# Default: show help
.PHONY: help
help:
@echo "Usage:"
@echo " make discover - Query .NET release metadata and show supported versions"
@echo " make build-apko - Build all apko base images locally"
@echo " make build MAJOR=10 - Build all variants for a specific .NET major version"
@echo " make clean - Remove build artifacts"
# Discover supported .NET versions from release metadata
.PHONY: discover
discover:
@echo "Fetching .NET release metadata..."
@curl -fsSL https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json | \
jq -r '.["releases-index"][] | select(.["support-phase"] == "active" or .["support-phase"] == "go-live") | "\(.["channel-version"])\t\(.["latest-runtime"])\t\(.["latest-sdk"])\t\(.["release-type"])\t\(.["support-phase"])"' | \
column -t -s$$'\t' -N "CHANNEL,RUNTIME,SDK,TYPE,PHASE"
# Build apko base images for a specific variant (local only)
.PHONY: build-apko
build-apko:
@for variant in $(VARIANTS); do \
echo "Building apko base: $$variant"; \
for arch in x86_64 aarch64; do \
docker run --rm -v $(PWD)/apko:/work cgr.dev/chainguard/apko build \
--arch $$arch /work/$$variant.yaml $$variant:latest build-$$arch/$$variant.tar.gz || exit 1; \
done; \
done
# Build all variants for a .NET major version
.PHONY: build
build:
ifndef MAJOR
$(error MAJOR is required, e.g. make build MAJOR=10)
endif
@echo "Building .NET $(MAJOR) images..."
@$(MAKE) build-variant VARIANT=runtime MAJOR=$(MAJOR)
@$(MAKE) build-variant VARIANT=runtime-invariant MAJOR=$(MAJOR)
@$(MAKE) build-variant VARIANT=sdk MAJOR=$(MAJOR)
# Build a single variant (internal target)
.PHONY: build-variant
build-variant:
@echo "Building $(VARIANT)-$(MAJOR)..."
@for arch in x86_64 aarch64; do \
docker run --rm -v $(PWD)/apko:/work cgr.dev/chainguard/apko build \
--arch $$arch /work/$(VARIANT).yaml $(VARIANT):latest build-$$arch/rootfs.tar.gz || exit 1; \
done
# Clean build artifacts
.PHONY: clean
clean:
rm -rf build-* dotnet-*