heyunfei commited on
Commit
6067e63
Β·
verified Β·
1 Parent(s): 9dcc337

Update webui/docker_start.sh

Browse files
Files changed (1) hide show
  1. webui/docker_start.sh +12 -4
webui/docker_start.sh CHANGED
@@ -5,9 +5,16 @@
5
  echo "πŸš€ Starting Kronos Web UI in Docker..."
6
  echo "======================================"
7
 
 
 
 
 
 
 
 
8
  # Check if we're in the correct directory
9
  if [ ! -f "app.py" ]; then
10
- echo "❌ app.py not found, please check the working directory"
11
  exit 1
12
  fi
13
 
@@ -31,15 +38,16 @@ except ImportError as e:
31
  "
32
 
33
  # Start the Flask application
34
- echo "🌐 Starting Flask server on port 7860..."
35
- echo "Access URL: http://localhost:7860"
 
36
  echo "Press Ctrl+C to stop server"
37
  echo ""
38
 
39
  # Use gunicorn for production if available, otherwise use Flask dev server
40
  if command -v gunicorn &> /dev/null; then
41
  echo "Using Gunicorn for production..."
42
- exec gunicorn --bind 0.0.0.0:7860 --workers 2 --timeout 120 --access-logfile - --error-logfile - app:app
43
  else
44
  echo "Using Flask development server..."
45
  exec python3 app.py
 
5
  echo "πŸš€ Starting Kronos Web UI in Docker..."
6
  echo "======================================"
7
 
8
+ # Ensure we run from the script directory (webui)
9
+ SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
10
+ cd "$SCRIPT_DIR" || {
11
+ echo "❌ Failed to change directory to $SCRIPT_DIR"
12
+ exit 1
13
+ }
14
+
15
  # Check if we're in the correct directory
16
  if [ ! -f "app.py" ]; then
17
+ echo "❌ app.py not found in $(pwd), please check the working directory"
18
  exit 1
19
  fi
20
 
 
38
  "
39
 
40
  # Start the Flask application
41
+ PORT="${PORT:-7860}"
42
+ echo "🌐 Starting Flask server on port ${PORT}..."
43
+ echo "Access URL: http://localhost:${PORT}"
44
  echo "Press Ctrl+C to stop server"
45
  echo ""
46
 
47
  # Use gunicorn for production if available, otherwise use Flask dev server
48
  if command -v gunicorn &> /dev/null; then
49
  echo "Using Gunicorn for production..."
50
+ exec gunicorn --bind 0.0.0.0:${PORT} --workers 2 --timeout 120 --access-logfile - --error-logfile - app:app
51
  else
52
  echo "Using Flask development server..."
53
  exec python3 app.py