Initial commit
This commit is contained in:
commit
13d85b92f1
12 changed files with 418 additions and 0 deletions
33
ublue-silverblue-main/build-push.sh
Executable file
33
ublue-silverblue-main/build-push.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
# Change to the directory where the script is located
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
DATE_TAG=$(date "+%Y%m%d-%H%M%S")
|
||||
CURRENT_IMAGE_ID=$(sudo podman images --format "{{.ID}}" cremin.dev/jonathan/ublue-silverblue-main:42)
|
||||
|
||||
|
||||
echo "Pulling base image"
|
||||
# ensure the base image is up to date
|
||||
sudo -E podman pull ghcr.io/ublue-os/silverblue-main:42
|
||||
|
||||
echo "Starting build"
|
||||
sudo -E podman build -t cremin.dev/jonathan/ublue-silverblue-main:42 .
|
||||
|
||||
NEW_IMAGE_ID=$(sudo podman images --format "{{.ID}}" cremin.dev/jonathan/ublue-silverblue-main:42)
|
||||
|
||||
|
||||
# Start build and check if any layers were changed (looking for "Using cache" messages)
|
||||
if [ "$CURRENT_IMAGE_ID" = "$NEW_IMAGE_ID" ]; then
|
||||
echo "No changes detected, skipping push"
|
||||
else
|
||||
echo "Image updated, pushing to registry"
|
||||
# Add the tags
|
||||
sudo -E podman tag cremin.dev/jonathan/ublue-silverblue-main:42 cremin.dev/jonathan/ublue-silverblue-main:42-${DATE_TAG} cremin.dev/jonathan/ublue-silverblue-main:latest
|
||||
# Push the image
|
||||
sudo -E podman push --authfile ~/.config/containers/auth.json cremin.dev/jonathan/ublue-silverblue-main:42-${DATE_TAG}
|
||||
sudo -E podman push --authfile ~/.config/containers/auth.json cremin.dev/jonathan/ublue-silverblue-main:42
|
||||
sudo -E podman push --authfile ~/.config/containers/auth.json cremin.dev/jonathan/ublue-silverblue-main:latest
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue