Ezmary commited on
Commit
b819585
·
verified ·
1 Parent(s): b372360

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -11
Dockerfile CHANGED
@@ -1,13 +1,11 @@
1
- # Dockerfile
 
2
  # Use an official Python runtime as a parent image
3
  FROM python:3.9-slim
4
 
5
  # Set the working directory in the container
6
  WORKDIR /app
7
 
8
- # Set the environment variable to tell huggingface_hub to use a writable directory
9
- ENV HF_HOME=/app/cache
10
-
11
  # Copy requirements first for better caching
12
  COPY requirements.txt .
13
 
@@ -17,15 +15,12 @@ RUN pip install --no-cache-dir -r requirements.txt
17
  # Copy the rest of the application's code
18
  COPY . .
19
 
20
- # --- START OF FINAL FIX ---
21
- # Grant full write permissions to the entire application directory.
22
- # This allows the app to create temporary files (like 'temp_usage_data.json')
23
- # and also allows huggingface_hub to create its cache directory.
24
- RUN chmod -R 777 /app
25
- # --- END OF FINAL FIX ---
26
 
27
  # Expose the port the app runs on
28
  EXPOSE 7860
29
 
 
30
  # Run app.py when the container launches
31
- CMD ["gunicorn", "--workers", "1", "--threads", "4", "--bind", "0.0.0.0:7860", "app:app"]
 
1
+ # Dockerfile (نسخه نهایی و بهینه شده)
2
+
3
  # Use an official Python runtime as a parent image
4
  FROM python:3.9-slim
5
 
6
  # Set the working directory in the container
7
  WORKDIR /app
8
 
 
 
 
9
  # Copy requirements first for better caching
10
  COPY requirements.txt .
11
 
 
15
  # Copy the rest of the application's code
16
  COPY . .
17
 
18
+ # <<< تغییر کلیدی: یک پوشه قابل نوشتن و مجزا برای فایل‌های موقت ایجاد می‌کنیم >>>
19
+ RUN mkdir -p /app/tmp && chmod 777 /app/tmp
 
 
 
 
20
 
21
  # Expose the port the app runs on
22
  EXPOSE 7860
23
 
24
+ # <<< تغییر کلیدی: بهینه سازی برای پردازش همزمان کاربران بیشتر >>>
25
  # Run app.py when the container launches
26
+ CMD ["gunicorn", "--workers", "2", "--threads", "4", "--bind", "0.0.0.0:7860", "app:app"]