debian-bootc-base-images/build.sh
2025-08-30 12:36:18 -07:00

61 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
set -xeuo pipefail
# Build script for Debian minimal bootc base images
# Usage: ./build.sh [proxy_url]
# Show help if requested
if [ "${1:-}" = "--help" ] || [ "${1:-}" = "-h" ]; then
echo "Usage: $0 [proxy_url]"
echo ""
echo "Build Debian minimal bootc base images with optional apt-cache-ng proxy"
echo ""
echo "Arguments:"
echo " proxy_url URL for apt-cache-ng proxy (default: http://192.168.1.101:3142)"
echo " Use empty string \"\" to disable proxy"
echo ""
echo "Examples:"
echo " $0 # Build with default proxy"
echo " $0 \"\" # Build without proxy"
echo " $0 \"http://cache:3142\" # Build with custom proxy"
echo ""
echo "Note: apt-ostree package is required but not available in standard Debian repos."
echo "You may need to build it from source or use a custom repository."
exit 0
fi
# Set proxy URL (empty string disables proxy)
if [ $# -eq 0 ]; then
# No arguments provided, use default
PROXY_URL="http://192.168.1.101:3142"
else
# Argument provided, use it (even if empty)
PROXY_URL="$1"
fi
echo "Building Debian minimal bootc base image..."
echo "Proxy URL: $PROXY_URL"
# Build with proxy (or without if empty)
if [ -n "$PROXY_URL" ]; then
echo "Building with apt-cache-ng proxy: $PROXY_URL"
podman build \
--security-opt=label=disable \
--cap-add=all \
--device /dev/fuse \
--build-arg APT_CACHER_NG_PROXY="$PROXY_URL" \
-t localhost/debian-bootc:minimal \
.
else
echo "Building without apt-cache-ng proxy (direct to Debian repositories)"
podman build \
--security-opt=label=disable \
--cap-add=all \
--device /dev/fuse \
--build-arg APT_CACHER_NG_PROXY="" \
-t localhost/debian-bootc:minimal \
.
fi
echo "Build complete!"
echo "Image tagged as: localhost/debian-bootc:minimal"