Severian commited on
Commit
473f6fd
·
verified ·
1 Parent(s): ff063df

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -4
Dockerfile CHANGED
@@ -39,7 +39,26 @@ COPY --from=web --chown=user /app/web /app/web/
39
  COPY --from=api --chown=user /app/api /app/api/
40
 
41
  # Install Python requirements
42
- RUN pip install --no-cache-dir gunicorn gevent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  # Set environment variables for Hugging Face Spaces
45
  ENV FLASK_APP=app.py \
@@ -49,7 +68,9 @@ ENV FLASK_APP=app.py \
49
  CONSOLE_WEB_URL=http://127.0.0.1:3000 \
50
  SERVICE_API_URL=http://127.0.0.1:7860 \
51
  APP_WEB_URL=http://127.0.0.1:3000 \
52
- HOME=/app
 
 
53
 
54
  # Switch to non-root user
55
  USER user
@@ -57,11 +78,17 @@ USER user
57
  # Expose Hugging Face Spaces required ports
58
  EXPOSE 7860 3000
59
 
60
- # Create startup script
61
  RUN echo '#!/bin/bash\n\
62
  echo "===== Application Startup at $(date "+%Y-%m-%d %H:%M:%S") ====="\n\
63
  echo "Starting Dify services..."\n\
64
- cd /app/api && python -m gunicorn app:app --bind 0.0.0.0:7860 --worker-class gevent --workers 1 &\n\
 
 
 
 
 
 
65
  echo "Starting API server on port 7860..."\n\
66
  cd /app/web && node server.js &\n\
67
  echo "Starting Next.js server on port 3000..."\n\
 
39
  COPY --from=api --chown=user /app/api /app/api/
40
 
41
  # Install Python requirements
42
+ RUN pip install --no-cache-dir \
43
+ gunicorn \
44
+ gevent \
45
+ pydantic-settings \
46
+ pydantic \
47
+ fastapi \
48
+ uvicorn \
49
+ python-multipart \
50
+ python-jose[cryptography] \
51
+ passlib[bcrypt] \
52
+ sqlalchemy \
53
+ psycopg2-binary \
54
+ alembic \
55
+ redis \
56
+ celery \
57
+ flower \
58
+ pytest \
59
+ pytest-cov \
60
+ pytest-asyncio \
61
+ httpx
62
 
63
  # Set environment variables for Hugging Face Spaces
64
  ENV FLASK_APP=app.py \
 
68
  CONSOLE_WEB_URL=http://127.0.0.1:3000 \
69
  SERVICE_API_URL=http://127.0.0.1:7860 \
70
  APP_WEB_URL=http://127.0.0.1:3000 \
71
+ HOME=/home/user \
72
+ PATH=/home/user/.local/bin:$PATH \
73
+ PYTHONPATH=/app/api
74
 
75
  # Switch to non-root user
76
  USER user
 
78
  # Expose Hugging Face Spaces required ports
79
  EXPOSE 7860 3000
80
 
81
+ # Create startup script with proper environment setup
82
  RUN echo '#!/bin/bash\n\
83
  echo "===== Application Startup at $(date "+%Y-%m-%d %H:%M:%S") ====="\n\
84
  echo "Starting Dify services..."\n\
85
+ cd /app/api && \
86
+ PYTHONPATH=/app/api python -m gunicorn app:app \
87
+ --bind 0.0.0.0:7860 \
88
+ --worker-class gevent \
89
+ --workers 1 \
90
+ --timeout 300 \
91
+ --preload &\n\
92
  echo "Starting API server on port 7860..."\n\
93
  cd /app/web && node server.js &\n\
94
  echo "Starting Next.js server on port 3000..."\n\