#!/bin/bash
set -e

#APP_DIR="/var/www/html/front-pte-core/build"
APP_DIR="/var/www/html/lacore-20task"
BUILD_DIR="$APP_DIR/build"

echo "Deploying React build to $APP_DIR"

# Copy new build files into the app directory
sudo cp -r $BUILD_DIR/* $APP_DIR/

# Delete the build folder after copying
sudo rm -rf $BUILD_DIR

# Set ownership and permissions
sudo chown -R ubuntu:www-data $APP_DIR
sudo chmod -R 755 $APP_DIR

echo "Deployment completed successfully"

