#!/bin/bash
set -e

cd /var/www/wolpmakeart/wolpmakeart-site

echo "Syncing project..."
webstudio sync

echo "Building project..."
webstudio build --template docker

echo "Rebuilding Docker image..."
docker build -t wolpmakeart .

echo "Restarting container..."
docker stop wolpmakeart 2>/dev/null || true
docker rm wolpmakeart 2>/dev/null || true
docker run -d --name wolpmakeart -p 3000:3000 --restart unless-stopped wolpmakeart

echo "Done! Site updated."
