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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -9
Dockerfile CHANGED
@@ -15,6 +15,8 @@ ENV NODE_VERSION=20.11.0 \
15
  RUN apt-get update && apt-get install -y \
16
  curl \
17
  git \
 
 
18
  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
19
  && apt-get install -y nodejs \
20
  && npm install -g npm@latest \
@@ -30,18 +32,21 @@ FROM base
30
  # Create non-root user (required by Hugging Face)
31
  RUN useradd -m -u 1000 user
32
 
33
- # Set up directory structure
34
  WORKDIR /app
35
- RUN mkdir -p api web && chown -R user:user /app
 
36
 
37
  # Copy from official images instead of building
38
  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 \
43
  gunicorn \
44
  gevent \
 
 
45
  pydantic-settings \
46
  pydantic \
47
  fastapi \
@@ -60,7 +65,10 @@ RUN pip install --no-cache-dir \
60
  pytest-asyncio \
61
  httpx
62
 
63
- # Set environment variables for Hugging Face Spaces
 
 
 
64
  ENV FLASK_APP=app.py \
65
  EDITION=SELF_HOSTED \
66
  DEPLOY_ENV=PRODUCTION \
@@ -70,15 +78,13 @@ ENV FLASK_APP=app.py \
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
77
-
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\
 
15
  RUN apt-get update && apt-get install -y \
16
  curl \
17
  git \
18
+ gcc \
19
+ python3-dev \
20
  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
21
  && apt-get install -y nodejs \
22
  && npm install -g npm@latest \
 
32
  # Create non-root user (required by Hugging Face)
33
  RUN useradd -m -u 1000 user
34
 
35
+ # Set up directory structure and persistent storage
36
  WORKDIR /app
37
+ RUN mkdir -p api web /data/storage && \
38
+ chown -R user:user /app /data
39
 
40
  # Copy from official images instead of building
41
  COPY --from=web --chown=user /app/web /app/web/
42
  COPY --from=api --chown=user /app/api /app/api/
43
 
44
+ # Install Python requirements including gRPC
45
  RUN pip install --no-cache-dir \
46
  gunicorn \
47
  gevent \
48
+ grpcio \
49
+ grpcio-tools \
50
  pydantic-settings \
51
  pydantic \
52
  fastapi \
 
65
  pytest-asyncio \
66
  httpx
67
 
68
+ # Create symlink for persistent storage
69
+ RUN ln -s /data/storage /app/api/storage
70
+
71
+ # Set environment variables
72
  ENV FLASK_APP=app.py \
73
  EDITION=SELF_HOSTED \
74
  DEPLOY_ENV=PRODUCTION \
 
78
  APP_WEB_URL=http://127.0.0.1:3000 \
79
  HOME=/home/user \
80
  PATH=/home/user/.local/bin:$PATH \
81
+ PYTHONPATH=/app/api \
82
+ STORAGE_PATH=/data/storage
83
 
 
84
  USER user
 
 
85
  EXPOSE 7860 3000
86
 
87
+ # Create startup script
88
  RUN echo '#!/bin/bash\n\
89
  echo "===== Application Startup at $(date "+%Y-%m-%d %H:%M:%S") ====="\n\
90
  echo "Starting Dify services..."\n\