rabiyulfahim commited on
Commit
8cdef72
·
verified ·
1 Parent(s): 040c903

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -11
Dockerfile CHANGED
@@ -1,10 +1,10 @@
1
- # Use lightweight Python base image
2
  FROM python:3.10-slim
3
-
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
 
10
  # Copy requirements and install
@@ -14,18 +14,16 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  # Copy application code
15
  COPY . .
16
 
17
- # Hugging Face cache directory
18
  ENV HF_HOME=/tmp
19
- # ENV TRANSFORMERS_CACHE=/tmp
 
20
 
21
- # Pre-download K2-Think model to avoid cold start
22
- # RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
23
- # model_id='LLM360/K2-Think'; \
24
- # AutoTokenizer.from_pretrained(model_id, cache_dir='/tmp'); \
25
- # AutoModelForCausalLM.from_pretrained(model_id, cache_dir='/tmp')"
26
 
27
  # Expose port
28
  EXPOSE 7860
29
 
30
- # Command to run the FastAPI app
31
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use lightweight Python image
2
  FROM python:3.10-slim
3
+
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies (git needed for Hugging Face)
8
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
 
10
  # Copy requirements and install
 
14
  # Copy application code
15
  COPY . .
16
 
17
+ # Set environment variables for cache dirs (Docker-friendly)
18
  ENV HF_HOME=/tmp
19
+ ENV TRANSFORMERS_CACHE=/tmp
20
+ ENV TORCHINDUCTOR_CACHE_DIR=/tmp/torch_inductor_cache
21
 
22
+ # Create cache folder
23
+ RUN mkdir -p /tmp/torch_inductor_cache
 
 
 
24
 
25
  # Expose port
26
  EXPOSE 7860
27
 
28
+ # Start FastAPI
29
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]