devorbit commited on
Commit
a326431
·
1 Parent(s): 26e1c2e

Upgrade to FULL mode: torch CUDA + transformers + bitsandbytes

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -8
Dockerfile CHANGED
@@ -10,15 +10,23 @@ RUN useradd -m -u 1000 appuser
10
 
11
  WORKDIR /app
12
 
13
- # Copy requirements first for layer caching
 
 
 
 
 
 
 
 
 
 
 
 
14
  COPY murshid_backend/requirements_light.txt ./requirements.txt
15
  RUN pip install --no-cache-dir -r requirements.txt \
16
  && pip install --no-cache-dir openpyxl aiofiles scikit-learn
17
 
18
- # Optional: install torch CPU-only for LOCAL mode (SecureBERT+ embeddings)
19
- # Uncomment the next line if you want LOCAL mode (adds ~800MB to image)
20
- # RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu transformers sentencepiece
21
-
22
  # Copy backend code
23
  COPY murshid_backend/ ./murshid_backend/
24
 
@@ -28,15 +36,17 @@ COPY Needed/ ./Needed/
28
  # Copy frontend
29
  COPY murshid_frontend/ ./murshid_frontend/
30
 
31
- # Create writable directory for SQLite DB
32
- RUN mkdir -p /app/data && chown -R appuser:appuser /app
33
 
34
  # Setup environment
35
  ENV MURSHID_DB_URL=sqlite:////app/data/murshid.db
36
  ENV MURSHID_MODELS_DIR=/app/Needed
37
- ENV MURSHID_SKIP_LLM=true
38
  ENV SECRET_KEY=murshid_hf_space_2026
39
  ENV PORT=7860
 
 
40
 
41
  # Run DB migrations + import templates + start server
42
  COPY start.sh ./start.sh
 
10
 
11
  WORKDIR /app
12
 
13
+ # Install PyTorch with CUDA 12.1 support
14
+ RUN pip install --no-cache-dir \
15
+ torch==2.3.1 --index-url https://download.pytorch.org/whl/cu121
16
+
17
+ # Install ML dependencies
18
+ RUN pip install --no-cache-dir \
19
+ transformers>=4.44.0 \
20
+ accelerate>=0.34.0 \
21
+ "bitsandbytes>=0.46.1" \
22
+ sentencepiece>=0.2.0 \
23
+ huggingface_hub>=0.25.0
24
+
25
+ # Install backend dependencies
26
  COPY murshid_backend/requirements_light.txt ./requirements.txt
27
  RUN pip install --no-cache-dir -r requirements.txt \
28
  && pip install --no-cache-dir openpyxl aiofiles scikit-learn
29
 
 
 
 
 
30
  # Copy backend code
31
  COPY murshid_backend/ ./murshid_backend/
32
 
 
36
  # Copy frontend
37
  COPY murshid_frontend/ ./murshid_frontend/
38
 
39
+ # Create writable directory for SQLite DB + HF cache
40
+ RUN mkdir -p /app/data /home/appuser/.cache && chown -R appuser:appuser /app /home/appuser
41
 
42
  # Setup environment
43
  ENV MURSHID_DB_URL=sqlite:////app/data/murshid.db
44
  ENV MURSHID_MODELS_DIR=/app/Needed
45
+ ENV MURSHID_SKIP_LLM=false
46
  ENV SECRET_KEY=murshid_hf_space_2026
47
  ENV PORT=7860
48
+ ENV HF_HOME=/home/appuser/.cache/huggingface
49
+ ENV TRANSFORMERS_CACHE=/home/appuser/.cache/huggingface/hub
50
 
51
  # Run DB migrations + import templates + start server
52
  COPY start.sh ./start.sh