FinMK / build.sh
Kumar
Refactor: Exclude PDF and CSV files from Git to fix HF push error
24e6f5b
#!/usr/bin/env bash
# exit on error
set -o errexit
# Ensure Cargo has a writable home directory for Rust-based builds
export CARGO_HOME=$HOME/.cargo
echo "=========================================="
echo " FinMK - Render Build Script"
echo "=========================================="
# 1. Install Global Dependencies (if any needed for OpenCV/etc that aren't in requirements)
# Render's native python env usually has what we need, or we use opencv-python-headless.
# 2. Build Frontend
echo "[Step 1/3] Building Frontend..."
cd frontend
npm install
npm run build
cd ..
# 3. Setup Backend & Collect Static
echo "[Step 2/3] Setting up Backend..."
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
# Post-install check for headless opencv
echo "Verifying headless libraries..."
pip install opencv-python-headless matplotlib
echo "[Step 3/3] Collecting Static Files..."
# Ensure staticfiles directory exists
mkdir -p staticfiles
# Collect static files (including frontend build due to STATICFILES_DIRS in settings)
python manage.py collectstatic --no-input
# Run Migrations (Optional here, can also be done in start.sh)
# Doing it here ensures the build fails if migrations are broken
python manage.py migrate --noinput
echo "=========================================="
echo " Build Successful!"
echo "=========================================="