Shahzaib98 commited on
Commit
51935fe
·
verified ·
1 Parent(s): 8342e33

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -10
Dockerfile CHANGED
@@ -1,23 +1,32 @@
1
- # Use HF's optimized Python image
2
- FROM registry.hf.space/python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
- ENV PYTHONUNBUFFERED=1
 
 
 
 
 
 
 
7
 
8
  # Copy requirements
9
  COPY requirements.txt .
10
 
11
- # Install PyTorch CPU only
12
- RUN pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu
 
 
 
13
 
14
- # Install dependencies
15
- RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- # Install spaCy model directly
18
- RUN pip install --no-cache-dir https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl
19
 
20
- # Copy application
21
  COPY . .
22
 
23
  EXPOSE 7860
 
1
+ FROM python:3.10-slim
 
2
 
3
  WORKDIR /app
4
 
5
+ ENV DEBIAN_FRONTEND=noninteractive \
6
+ PYTHONUNBUFFERED=1 \
7
+ PIP_NO_CACHE_DIR=1
8
+
9
+ # Install minimal system dependencies
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ build-essential \
12
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
13
 
14
  # Copy requirements
15
  COPY requirements.txt .
16
 
17
+ # Upgrade pip
18
+ RUN pip install --upgrade pip
19
+
20
+ # Install PyTorch CPU (lighter weight)
21
+ RUN pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu
22
 
23
+ # Install all other dependencies in one go
24
+ RUN pip install -r requirements.txt
25
 
26
+ # Download spaCy model with direct URL (more reliable)
27
+ RUN pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl
28
 
29
+ # Copy app code
30
  COPY . .
31
 
32
  EXPOSE 7860