Spaces:
Sleeping
Sleeping
abubasith86
commited on
Commit
Β·
8bcabf8
1
Parent(s):
e0e3d24
CHG
Browse files
deploy.sh
CHANGED
@@ -10,7 +10,7 @@ echo "π Deployment started..."
|
|
10 |
# Check if directory exists
|
11 |
if [ -d "$APP_DIR" ]; then
|
12 |
cd "$APP_DIR"
|
13 |
-
|
14 |
# Check if it is a Git repository
|
15 |
if [ -d ".git" ]; then
|
16 |
echo "π Directory exists, pulling latest changes..."
|
@@ -18,7 +18,7 @@ if [ -d "$APP_DIR" ]; then
|
|
18 |
git pull origin "$BRANCH"
|
19 |
else
|
20 |
echo "β οΈ Not a valid Git repository. Removing directory and re-cloning..."
|
21 |
-
|
22 |
git clone -b "$BRANCH" "$GIT_REPO" "$APP_DIR"
|
23 |
fi
|
24 |
else
|
@@ -29,14 +29,14 @@ fi
|
|
29 |
# Navigate to app directory
|
30 |
cd "$APP_DIR"
|
31 |
|
32 |
-
#
|
33 |
echo "π§ Fixing permissions..."
|
34 |
-
|
35 |
-
|
36 |
|
37 |
# Install dependencies
|
38 |
echo "π¦ Installing dependencies..."
|
39 |
-
npm install
|
40 |
|
41 |
# Start the server
|
42 |
echo "π Starting the server..."
|
|
|
10 |
# Check if directory exists
|
11 |
if [ -d "$APP_DIR" ]; then
|
12 |
cd "$APP_DIR"
|
13 |
+
|
14 |
# Check if it is a Git repository
|
15 |
if [ -d ".git" ]; then
|
16 |
echo "π Directory exists, pulling latest changes..."
|
|
|
18 |
git pull origin "$BRANCH"
|
19 |
else
|
20 |
echo "β οΈ Not a valid Git repository. Removing directory and re-cloning..."
|
21 |
+
rm -rf "$APP_DIR"
|
22 |
git clone -b "$BRANCH" "$GIT_REPO" "$APP_DIR"
|
23 |
fi
|
24 |
else
|
|
|
29 |
# Navigate to app directory
|
30 |
cd "$APP_DIR"
|
31 |
|
32 |
+
# Fix file permissions for Node.js
|
33 |
echo "π§ Fixing permissions..."
|
34 |
+
chown -R $(whoami) "$APP_DIR"
|
35 |
+
chmod -R 755 "$APP_DIR"
|
36 |
|
37 |
# Install dependencies
|
38 |
echo "π¦ Installing dependencies..."
|
39 |
+
npm install --unsafe-perm
|
40 |
|
41 |
# Start the server
|
42 |
echo "π Starting the server..."
|