From fc3de7269dfd6493079a82ef0741f46211db8822 Mon Sep 17 00:00:00 2001 From: sajjadtalkhabi <97734061+sajjadtalkhabi@users.noreply.github.com> Date: Thu, 21 May 2026 17:59:29 +0330 Subject: [PATCH] fix: deploy --- deploy.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..0fa2407 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +REPO="ssh://git@git.meshkee.com:222/sajjad.talkhabi/test.git" +APP_DIR="/root/banu-front" +IMAGE="banu-front" +CONTAINER="banu-front" +PORT="8080" +VITE_API_BASE_URL="http://109.122.252.86/api" + +echo "==> Pulling latest code..." +if [ -d "$APP_DIR/.git" ]; then + git -C "$APP_DIR" pull +else + git clone "$REPO" "$APP_DIR" +fi + +echo "==> Building Docker image..." +docker build \ + --build-arg VITE_API_BASE_URL="$VITE_API_BASE_URL" \ + -t "$IMAGE" "$APP_DIR" + +echo "==> Stopping old container..." +docker rm -f "$CONTAINER" 2>/dev/null || true + +echo "==> Starting new container..." +docker run -d \ + --name "$CONTAINER" \ + --restart unless-stopped \ + -p "$PORT:80" \ + "$IMAGE" + +echo "==> Done. App running at http://$(hostname -I | awk '{print $1}'):$PORT"