diff options
author | doc <doc@filenotfound.org> | 2025-06-30 20:11:52 +0000 |
---|---|---|
committer | doc <doc@filenotfound.org> | 2025-06-30 20:11:52 +0000 |
commit | 41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch) | |
tree | db7c3520fd91abc3cf56b1a52095d23f3a80d059 /pushandbuild.sh |
Diffstat (limited to 'pushandbuild.sh')
-rwxr-xr-x | pushandbuild.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pushandbuild.sh b/pushandbuild.sh new file mode 100755 index 0000000..9f25c1c --- /dev/null +++ b/pushandbuild.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# push_and_build.sh — Build Python app on Shredder w/o installing or bundling .env + +read -p "Enter the name of the app (folder name, e.g., radiotoot): " APP_NAME +read -p "Enter the main script filename (e.g., app.py): " MAIN_SCRIPT + +REMOTE_HOST="shredder.sshjunkie.com" +REMOTE_BASE="/assets/clientapps" +LOCAL_PATH="/home/doc/$APP_NAME" +REMOTE_PATH="$REMOTE_BASE/$APP_NAME" + +# Double-check local folder +if [ ! -d "$LOCAL_PATH" ]; then + echo "[-] Local app path $LOCAL_PATH does not exist." + exit 1 +fi + +echo "[*] Syncing $APP_NAME to $REMOTE_HOST (excluding .env and venv)..." +rsync -av --exclude 'venv' --exclude 'dist' --exclude '__pycache__' \ + --exclude '*.spec' --exclude '.env' \ + "$LOCAL_PATH/" "doc@$REMOTE_HOST:$REMOTE_PATH/" + +echo "[*] Triggering remote build on $REMOTE_HOST..." +ssh doc@$REMOTE_HOST bash -c "' + set -e + cd $REMOTE_PATH + echo \"[*] Rebuilding venv...\" + python3 -m venv venv + source venv/bin/activate + pip install -r requirements.txt + pip install pyinstaller + echo \"[*] Building binary...\" + pyinstaller --onefile --name=$APP_NAME \ + --add-data \"templates:templates\" \ + --add-data \"migrations:migrations\" \ + $MAIN_SCRIPT + echo \"[+] Build complete. Binary available in: $REMOTE_PATH/dist/$APP_NAME\" +'" + +echo "[✓] Done. You can test the binary at Shredder:$REMOTE_PATH/dist/$APP_NAME" |