pipelines/start.sh
2024-05-30 11:55:27 -07:00

24 lines
796 B
Bash
Executable File

#!/usr/bin/env bash
PORT="${PORT:-9099}"
HOST="${HOST:-0.0.0.0}"
# Function to install requirements if requirements.txt is provided
install_requirements() {
if [[ -f "$1" ]]; then
echo "requirements.txt found at $1. Installing dependencies..."
pip install -r "$1"
else
echo "requirements.txt not found at $1. Skipping installation of dependencies."
fi
}
# Check if the PIPELINES_REQUIREMENTS_PATH environment variable is set and non-empty
if [[ -n "$PIPELINES_REQUIREMENTS_PATH" ]]; then
# Install dependencies from the specified requirements.txt
install_requirements "$PIPELINES_REQUIREMENTS_PATH"
else
echo "PIPELINES_REQUIREMENTS_PATH not specified. Skipping installation of dependencies."
fi
uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*'