File size: 1,386 Bytes
24e6f5b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/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 "=========================================="
|