Nguyendat92929 commited on
Commit
2d684f1
·
verified ·
1 Parent(s): e0e1bb7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -12
Dockerfile CHANGED
@@ -4,32 +4,37 @@ FROM python:3.11-slim
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install system dependencies for MongoDB and other libraries
8
  RUN apt-get update && apt-get install -y \
9
  gcc \
10
  g++ \
11
  libffi-dev \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  # Copy the requirements file into the container
15
-
16
-
17
-
18
  COPY requirements.txt .
19
 
20
  # Install Python dependencies
21
  RUN pip install --no-cache-dir -r requirements.txt
 
22
 
23
- # Set up a cache directory with proper permissions
24
- ENV HF_HOME=/app/.cache/huggingface
25
- RUN mkdir -p /app/.cache/huggingface && \
26
- chmod -R 777 /app/.cache/huggingface
 
27
 
 
 
 
 
 
28
 
29
- # Copy the entire application code into the container
30
  COPY . .
31
 
32
- # Expose the port Hugging Face Spaces expects (7860)
33
  EXPOSE 7860
34
 
35
  # Set environment variables
@@ -37,5 +42,5 @@ ENV FLASK_ENV=production
37
  ENV PYTHONUNBUFFERED=1
38
  ENV PORT=7860
39
 
40
- # Command to run the application with Flask-SocketIO
41
- CMD ["python", "-m", "flask", "run", "--host=0.0.0.0", "--port=7860"]
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies for MongoDB, FAISS, and other libraries
8
  RUN apt-get update && apt-get install -y \
9
  gcc \
10
  g++ \
11
  libffi-dev \
12
+ wget \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Copy the requirements file into the container
 
 
 
16
  COPY requirements.txt .
17
 
18
  # Install Python dependencies
19
  RUN pip install --no-cache-dir -r requirements.txt
20
+ RUN pip install gunicorn certifi eventlet
21
 
22
+ # Download Boxicons fonts to fix 404 error
23
+ RUN mkdir -p /app/static/fonts && \
24
+ wget -P /app/static/fonts https://unpkg.com/[email protected]/fonts/boxicons.woff2 && \
25
+ wget -P /app/static/fonts https://unpkg.com/[email protected]/fonts/boxicons.woff && \
26
+ wget -P /app/static/fonts https://unpkg.com/[email protected]/fonts/boxicons.ttf
27
 
28
+ # Set up cache, log, and session directories with proper permissions
29
+ ENV HF_HOME=/app/.cache/huggingface
30
+ ENV FLASK_SESSION_DIR=/app/sessions
31
+ RUN mkdir -p /app/.cache/huggingface /app/logs /app/sessions /app/static/fonts /app/embedding_data && \
32
+ chmod -R 777 /app/.cache/huggingface /app/logs /app/sessions /app/static/fonts /app/embedding_data
33
 
34
+ # Copy the entire application code, including embedding_data
35
  COPY . .
36
 
37
+ # Expose the port Hugging Face Spaces expects
38
  EXPOSE 7860
39
 
40
  # Set environment variables
 
42
  ENV PYTHONUNBUFFERED=1
43
  ENV PORT=7860
44
 
45
+ # Command to run the application with Gunicorn
46
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "4", "--timeout", "120", "--worker-class", "eventlet", "app:app"]