SakibAhmed commited on
Commit
5419d77
·
verified ·
1 Parent(s): c06eaa7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -13,8 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
13
  # Copy the requirements file
14
  COPY requirements.txt requirements.txt
15
 
16
- # Install Python packages
17
- RUN pip install --no-cache-dir -r requirements.txt
18
 
19
  # Copy application code
20
  COPY . /app
@@ -28,13 +28,18 @@ RUN chown -R user:user /app
28
  # Switch to the non-root user
29
  USER user
30
 
31
- # Expose the port Gunicorn will run on (Using 7860 as in CMD)
32
  EXPOSE 7860
33
 
34
- # Set environment variables for Flask host and port
35
  ENV FLASK_HOST=0.0.0.0
36
  ENV FLASK_PORT=7860
37
- # ENV FLASK_DEBUG="False" # Explicitly set if needed, app.py defaults to False if var not present
38
 
39
- # Command to run the app (app.py will now pick up FLASK_HOST and FLASK_PORT from ENV)
 
 
 
 
 
40
  CMD ["python", "app.py"]
 
13
  # Copy the requirements file
14
  COPY requirements.txt requirements.txt
15
 
16
+ # Install Python packages with timeout increase
17
+ RUN pip install --no-cache-dir --timeout=1000 -r requirements.txt
18
 
19
  # Copy application code
20
  COPY . /app
 
28
  # Switch to the non-root user
29
  USER user
30
 
31
+ # Expose the port
32
  EXPOSE 7860
33
 
34
+ # Set environment variables
35
  ENV FLASK_HOST=0.0.0.0
36
  ENV FLASK_PORT=7860
37
+ ENV FLASK_DEBUG=False
38
 
39
+ # CRITICAL: Set HF-specific env vars
40
+ ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
41
+ ENV HF_HOME=/tmp/hf_home
42
+ ENV TORCH_HOME=/tmp/torch_home
43
+
44
+ # Command to run the app
45
  CMD ["python", "app.py"]