#!/bin/bash

set -x

export BUILD_TAG=$(date +"%Y-%m-%d-%H-%M-%S")

echo "Updates stable-diffusion.cpp, llama.cpp, and open-webui"

cd /home/ai/llama.cpp
git pull
podman build -t llama-cpp-vulkan:${BUILD_TAG} -t llama-cpp-vulkan:latest -f .devops/vulkan.Dockerfile .

cd /home/ai/stable-diffusion.cpp
git pull
git submodule update --init --recursive
podman build -f Dockerfile.vulkan -t stable-diffusion-cpp:${BUILD_TAG} -t stable-diffusion-cpp:latest .

systemctl --user restart ai-internal-pod

podman image pull ghcr.io/open-webui/open-webui:main

systemctl --user restart ai-external-pod