diff --git a/Dockerfile b/Dockerfile index 418329f..237f459 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,5 @@ # syntax=docker/dockerfile:1 -# One image, built on the distribution base published by -# https://github.com/kevinveenbirkenbach/base-images, which owns the build -# dependencies this used to install in a `virgin` stage of its own. -# # hadolint ignore=DL3006,InvalidDefaultArgInFrom # BASE_IMAGE carries no default on purpose: a default would build one # distribution's image under another distribution's tag whenever the build arg diff --git a/Makefile b/Makefile index 14bab8f..d64b4ac 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,6 @@ export NIX_CONFIG # ------------------------------------------------------------ # Base images -# Published by https://github.com/kevinveenbirkenbach/base-images and resolved -# by scripts/build/base.sh; override the registry, owner or tag there. # ------------------------------------------------------------ BASE_IMAGES_TAG ?= latest export BASE_IMAGES_TAG diff --git a/README.md b/README.md index 814c232..e5d7e0c 100644 --- a/README.md +++ b/README.md @@ -169,26 +169,31 @@ nix run github:kevinveenbirkenbach/package-manager#pkgmgr -- --help PKGMGR can be executed **inside Docker containers** for CI, testing and isolated workflows. + --- -#### Container types +#### Container images -Two container types are available. +One image per distribution, each installing PKGMGR as a distro-native package +on top of the matching base image from +[base-images](https://github.com/kevinveenbirkenbach/base-images). Every image +is a manifest list covering `linux/amd64` and `linux/arm64`. +All images live under `ghcr.io/kevinveenbirkenbach/`: -| Image type | Contains | Typical use | -| ---------- | ----------------------------- | ----------------------- | -| **Virgin** | Base OS + system dependencies | Clean test environments | -| **Stable** | PKGMGR + Nix (flakes enabled) | Ready-to-use workflows | +| Tag | Contains | +| --------------------------- | ---------------------------------- | +| `pkgmgr-:latest` | newest build for that distribution | +| `pkgmgr-:` | one release | +| `pkgmgr-:stable` | newest release marked stable | -Example images: +`` is one of `arch`, `debian`, `ubuntu`, `fedora`, `centos`. The Arch +image is published without the suffix as well, so `pkgmgr:stable` and +`pkgmgr-arch:stable` are the same image. -* Virgin: `pkgmgr-arch-virgin` -* Stable: `ghcr.io/kevinveenbirkenbach/pkgmgr:stable` - - -Use **virgin images** for isolated test runs, -use the **stable image** for fast, reproducible execution. +For a clean environment that carries the system dependencies but no PKGMGR, +pull `base-` from +[base-images](https://github.com/kevinveenbirkenbach/base-images) directly. --- diff --git a/scripts/build/publish.sh b/scripts/build/publish.sh index b1be3c9..df20618 100755 --- a/scripts/build/publish.sh +++ b/scripts/build/publish.sh @@ -11,9 +11,6 @@ set -euo pipefail # REGISTRY (default: ghcr.io) # IS_STABLE (default: false) # DISTROS (default: "arch debian ubuntu fedora centos") -# -# The `virgin` variant moved to https://github.com/kevinveenbirkenbach/base-images -# and `slim` is gone: one image per distribution, no target to pick. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" diff --git a/scripts/docker/slim.sh b/scripts/docker/slim.sh deleted file mode 100644 index 4c27476..0000000 --- a/scripts/docker/slim.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -log() { echo "[cleanup] $*"; } -warn() { echo "[cleanup][WARN] $*" >&2; } - -MODE="${MODE:-safe}" # safe | aggressive -# safe: caches/logs/tmp only -# aggressive: safe + docs/man/info (optional) - -ID="unknown" -if [ -f /etc/os-release ]; then - # shellcheck disable=SC1091 - . /etc/os-release - ID="${ID:-unknown}" -fi - -log "Starting image cleanup" -log "Mode: ${MODE}" -log "Detected OS: ${ID}" - -# ------------------------------------------------------------ -# Package manager caches (SAFE) -# ------------------------------------------------------------ -case "${ID}" in - alpine) - log "Cleaning apk cache" - if [ -d /var/cache/apk ]; then - du -sh /var/cache/apk || true - rm -rvf /var/cache/apk/* || true - else - log "apk cache directory not present (already clean)" - fi - ;; - arch) - log "Cleaning pacman cache" - du -sh /var/cache/pacman/pkg 2>/dev/null || true - pacman -Scc --noconfirm || true - rm -rvf /var/cache/pacman/pkg/* || true - ;; - debian|ubuntu) - log "Cleaning apt cache" - du -sh /var/lib/apt/lists 2>/dev/null || true - apt-get clean || true - rm -rvf /var/lib/apt/lists/* || true - ;; - fedora) - log "Cleaning dnf cache" - du -sh /var/cache/dnf 2>/dev/null || true - dnf clean all || true - rm -rvf /var/cache/dnf/* || true - ;; - centos|rhel) - log "Cleaning yum/dnf cache" - du -sh /var/cache/yum /var/cache/dnf 2>/dev/null || true - (command -v dnf >/dev/null 2>&1 && dnf clean all) || true - (command -v yum >/dev/null 2>&1 && yum clean all) || true - rm -rvf /var/cache/yum/* /var/cache/dnf/* || true - ;; - *) - warn "Unknown distro '${ID}' — skipping package manager cleanup" - ;; -esac - -# ------------------------------------------------------------ -# Python caches (SAFE) -# ------------------------------------------------------------ -log "Cleaning pip cache" -du -sh /root/.cache/pip 2>/dev/null || true -rm -rvf /root/.cache/pip 2>/dev/null || true -rm -rvf /home/*/.cache/pip 2>/dev/null || true - -log "Cleaning __pycache__ directories" -find /opt /usr /root /home -type d -name "__pycache__" -print -prune 2>/dev/null || true -find /opt /usr /root /home -type d -name "__pycache__" -prune -exec rm -rvf {} + 2>/dev/null || true - -# ------------------------------------------------------------ -# Logs (SAFE) -# ------------------------------------------------------------ -log "Truncating log files (keeping paths intact)" -if [ -d /var/log ]; then - find /var/log -type f -name "*.log" -print 2>/dev/null || true - find /var/log -type f -name "*.log" -exec sh -lc ': > "$1" 2>/dev/null || true' _ {} \; 2>/dev/null || true - - find /var/log -type f -name "*.out" -print 2>/dev/null || true - find /var/log -type f -name "*.out" -exec sh -lc ': > "$1" 2>/dev/null || true' _ {} \; 2>/dev/null || true -fi - -if command -v journalctl >/dev/null 2>&1; then - log "Vacuuming journald logs" - journalctl --disk-usage || true - journalctl --vacuum-size=10M || true - journalctl --vacuum-time=1s || true - journalctl --disk-usage || true -else - log "journald not present (skipping)" -fi - -# ------------------------------------------------------------ -# Temporary files (SAFE) -# ------------------------------------------------------------ -log "Cleaning temporary directories" -if [ -d /tmp ]; then - du -sh /tmp 2>/dev/null || true - rm -rvf /tmp/* || true -fi - -if [ -d /var/tmp ]; then - du -sh /var/tmp 2>/dev/null || true - rm -rvf /var/tmp/* || true -fi - -# ------------------------------------------------------------ -# Generic caches (SAFE) -# ------------------------------------------------------------ -log "Cleaning generic caches" -du -sh /root/.cache 2>/dev/null || true -rm -rvf /root/.cache/* 2>/dev/null || true -rm -rvf /home/*/.cache/* 2>/dev/null || true - -# ------------------------------------------------------------ -# Optional aggressive extras (still safe for runtime) -# ------------------------------------------------------------ -if [[ "${MODE}" == "aggressive" ]]; then - log "Aggressive mode enabled: removing docs/man/info" - du -sh /usr/share/doc /usr/share/man /usr/share/info 2>/dev/null || true - rm -rvf /usr/share/doc/* /usr/share/man/* /usr/share/info/* 2>/dev/null || true -fi - -log "Cleanup finished successfully"