FarahMohsenSamy1 commited on
Commit
8022f4b
·
verified ·
1 Parent(s): 631e806

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -4
Dockerfile CHANGED
@@ -6,13 +6,24 @@ WORKDIR /app
6
  # Install necessary dependencies
7
  RUN apt-get update && apt-get install -y busybox wget curl && rm -rf /var/lib/apt/lists/*
8
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Install Python dependencies
10
  RUN pip install --no-cache-dir \
11
- torch==2.0.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
12
 
13
  RUN pip install --no-cache-dir \
14
  pandas "numpy<2" matplotlib scikit-learn tqdm scipy networkx \
15
- torch-geometric requests schedule fastapi uvicorn jinja2 python-multipart gradio datasets
16
 
17
  # Create necessary directories with correct permissions
18
  RUN mkdir -p /app/logs /app/models /app/scripts /app/data /app/templates
@@ -30,5 +41,4 @@ COPY app.py /app/app.py
30
  RUN chmod +x /app/train.py /app/scheduler.py
31
 
32
  # Run both FastAPI server and the training scheduler in parallel
33
- CMD ["sh", "-c", "python scheduler.py && python app.py"]
34
-
 
6
  # Install necessary dependencies
7
  RUN apt-get update && apt-get install -y busybox wget curl && rm -rf /var/lib/apt/lists/*
8
 
9
+ # Create cache directories with proper permissions BEFORE installing packages
10
+ RUN mkdir -p /app/cache/huggingface /app/cache/transformers /app/cache/datasets
11
+ RUN chmod -R 777 /app/cache
12
+
13
+ # Set Hugging Face environment variables
14
+ ENV HF_HOME=/app/cache/huggingface
15
+ ENV TRANSFORMERS_CACHE=/app/cache/transformers
16
+ ENV HF_DATASETS_CACHE=/app/cache/datasets
17
+ ENV HUGGINGFACE_HUB_CACHE=/app/cache/huggingface
18
+ ENV HF_HUB_CACHE=/app/cache/huggingface
19
+
20
  # Install Python dependencies
21
  RUN pip install --no-cache-dir \
22
+ torch==2.0.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
23
 
24
  RUN pip install --no-cache-dir \
25
  pandas "numpy<2" matplotlib scikit-learn tqdm scipy networkx \
26
+ torch-geometric requests schedule fastapi uvicorn jinja2 python-multipart gradio datasets
27
 
28
  # Create necessary directories with correct permissions
29
  RUN mkdir -p /app/logs /app/models /app/scripts /app/data /app/templates
 
41
  RUN chmod +x /app/train.py /app/scheduler.py
42
 
43
  # Run both FastAPI server and the training scheduler in parallel
44
+ CMD ["sh", "-c", "python scheduler.py && python app.py"]