fix: deploy
This commit is contained in:
@@ -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"
|
||||||
Reference in New Issue
Block a user