#!/bin/bash
# Deploy script voor Claude Code Workshop sales page
# Bouwt de site en deployt naar de Coolify WordPress container
#
# Gebruik: ./deploy.sh

set -e

SERVER="coolify-deploy"
CONTAINER="wordpress-d0wko4gskokosssogcw8040g"
REMOTE_PATH="/var/www/html/workshopclaudecode"
TMP_PATH="/tmp/workshopclaudecode"

echo "1/4 - Building..."
npm run build --silent

echo "2/4 - Uploading naar server..."
rsync -avz --quiet dist/ "$SERVER:$TMP_PATH/"

echo "3/4 - Kopieren naar container..."
ssh "$SERVER" "docker cp $TMP_PATH/. $CONTAINER:$REMOTE_PATH/ && docker exec $CONTAINER chown -R www-data:www-data $REMOTE_PATH/"

echo "4/4 - Opruimen..."
ssh "$SERVER" "rm -rf $TMP_PATH"

echo "Done! https://frankmeeuwsen.com/workshopclaudecode/"
