chore: Add cross-engine build and push script
This commit is contained in:
parent
4df0499d14
commit
3eb9e0b5a5
36
build.sh
Executable file
36
build.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Configuration with smart defaults (overridable via environment variables)
|
||||
REGISTRY=${REGISTRY:-"quay.atyg.org"}
|
||||
NAMESPACE=${NAMESPACE:-"library"}
|
||||
IMAGE_NAME=${IMAGE_NAME:-"custom-nas-web"}
|
||||
TAG=${TAG:-"latest"}
|
||||
|
||||
FULL_IMAGE_NAME="$REGISTRY/$NAMESPACE/$IMAGE_NAME:$TAG"
|
||||
|
||||
# Auto-detect container engine (podman or docker)
|
||||
if command -v podman &> /dev/null; then
|
||||
ENGINE="podman"
|
||||
elif command -v docker &> /dev/null; then
|
||||
ENGINE="docker"
|
||||
else
|
||||
echo "❌ Error: Neither podman nor docker found in PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚀 Building image using $ENGINE..."
|
||||
echo "📦 Target: $FULL_IMAGE_NAME"
|
||||
|
||||
# Build the image
|
||||
$ENGINE build -t "$FULL_IMAGE_NAME" .
|
||||
|
||||
# Handle optional push flag
|
||||
if [[ "$1" == "--push" || "$2" == "--push" ]]; then
|
||||
echo "☁️ Pushing to registry..."
|
||||
$ENGINE push "$FULL_IMAGE_NAME"
|
||||
echo "✅ Push complete!"
|
||||
else
|
||||
echo "✅ Build complete!"
|
||||
echo "💡 Tip: To build and push in one step, run: ./build.sh --push"
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user