aradhyapavan commited on
Commit
01b8737
·
verified ·
1 Parent(s): 6c54eb3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -50
Dockerfile CHANGED
@@ -1,50 +1,52 @@
1
- FROM python:3.10-slim
2
-
3
- # Prevents Python from writing .pyc files and ensures logs are shown immediately
4
- ENV PYTHONDONTWRITEBYTECODE=1 \
5
- PYTHONUNBUFFERED=1 \
6
- HOME=/app \
7
- XDG_CACHE_HOME=/app/.cache \
8
- HF_HOME=/app/.cache/huggingface \
9
- HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface/hub \
10
- TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
11
-
12
- # System deps
13
- RUN apt-get update && apt-get install -y --no-install-recommends \
14
- build-essential \
15
- git \
16
- curl \
17
- libgl1 \
18
- && rm -rf /var/lib/apt/lists/*
19
-
20
- WORKDIR /app
21
-
22
- # Copy requirements first for better layer caching
23
- COPY requirements.txt /app/requirements.txt
24
-
25
- # Install Python dependencies
26
- RUN pip install --no-cache-dir -r /app/requirements.txt
27
-
28
- # Copy the application
29
- COPY . /app
30
-
31
- # Create necessary directories at build/run time
32
- RUN mkdir -p /app/uploads /app/faiss_indices \
33
- /app/.cache \
34
- /app/.cache/huggingface \
35
- /app/.cache/huggingface/hub \
36
- /app/.cache/huggingface/transformers
37
-
38
- # Expose the port used by Hugging Face Spaces
39
- EXPOSE 7860
40
-
41
- # Environment variables (HF Spaces sets PORT at runtime)
42
- ENV PORT=7860 \
43
- HOST=0.0.0.0 \
44
- HF_SPACE=1
45
-
46
- # Start the server with gunicorn, binding to $PORT
47
- # app:app refers to Flask app object named `app` in app.py
48
- CMD exec gunicorn --bind 0.0.0.0:${PORT} --workers 2 --threads 8 --timeout 120 app:app
49
-
50
-
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Prevents Python from writing .pyc files and ensures logs are shown immediately
4
+ ENV PYTHONDONTWRITEBYTECODE=1 \
5
+ PYTHONUNBUFFERED=1 \
6
+ HOME=/app \
7
+ XDG_CACHE_HOME=/app/.cache \
8
+ HF_HOME=/app/.cache/huggingface \
9
+ HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface/hub \
10
+ TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers \
11
+ TOKENIZERS_PARALLELISM=false
12
+
13
+ # System deps
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ build-essential \
16
+ git \
17
+ curl \
18
+ libgl1 \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ WORKDIR /app
22
+
23
+ # Copy requirements first for better layer caching
24
+ COPY requirements.txt /app/requirements.txt
25
+
26
+ # Install Python dependencies
27
+ RUN pip install --no-cache-dir -r /app/requirements.txt
28
+
29
+ # Copy the application
30
+ COPY . /app
31
+
32
+ # Create necessary directories at build/run time
33
+ RUN mkdir -p /app/uploads /app/faiss_indices \
34
+ /app/.cache \
35
+ /app/.cache/huggingface \
36
+ /app/.cache/huggingface/hub \
37
+ /app/.cache/huggingface/transformers \
38
+ && chmod -R 777 /app/.cache /app/uploads /app/faiss_indices
39
+
40
+ # Expose the port used by Hugging Face Spaces
41
+ EXPOSE 7860
42
+
43
+ # Environment variables (HF Spaces sets PORT at runtime)
44
+ ENV PORT=7860 \
45
+ HOST=0.0.0.0 \
46
+ HF_SPACE=1
47
+
48
+ # Start the server with gunicorn, binding to $PORT
49
+ # app:app refers to Flask app object named `app` in app.py
50
+ CMD exec gunicorn --bind 0.0.0.0:${PORT} --workers 1 --threads 8 --timeout 180 app:app
51
+
52
+