| 1 | #!/bin/bash |
| 2 | set -e |
| 3 | |
| 4 | # Exit immediately if a command exits with a non-zero status. |
| 5 | # set -e |
| 6 | |
| 7 | # branch from parameter |
| 8 | if [ -z "$1" ]; then |
| 9 | echo "Error: Branch parameter is empty. Please provide a valid branch name." |
| 10 | exit 1 |
| 11 | fi |
| 12 | BRANCH="$1" |
| 13 | |
| 14 | if [ "$BRANCH" = "local" ]; then |
| 15 | # For local branch, use the files |
| 16 | echo "Using local dev files in /git/agent-zero" |
| 17 | # List all files recursively in the target directory |
| 18 | # echo "All files in /git/agent-zero (recursive):" |
| 19 | # find "/git/agent-zero" -type f | sort |
| 20 | else |
| 21 | # For other branches, clone from GitHub |
| 22 | echo "Cloning repository from branch $BRANCH..." |
| 23 | git clone -b "$BRANCH" "https://github.com/agent0ai/agent-zero" "/git/agent-zero" || { |
| 24 | echo "CRITICAL ERROR: Failed to clone repository. Branch: $BRANCH" |
| 25 | exit 1 |
| 26 | } |
| 27 | fi |
| 28 | |
| 29 | . "/ins/setup_venv.sh" "$@" |
| 30 | |
| 31 | # moved to base image |
| 32 | # # Ensure the virtual environment and pip setup |
| 33 | # pip install --upgrade pip ipython requests |
| 34 | # # Install some packages in specific variants |
| 35 | # pip install torch --index-url https://download.pytorch.org/whl/cpu |
| 36 | |
| 37 | # Install remaining A0 python packages |
| 38 | uv pip install -r /git/agent-zero/requirements.txt |
| 39 | |
| 40 | # install playwright |
| 41 | bash /ins/install_playwright.sh "$@" |
| 42 | |
| 43 | # Preload A0 |
| 44 | python /git/agent-zero/preload.py --dockerized=true |