File size: 950 Bytes
be0722d
d0ad78e
 
 
 
 
be0722d
2e910dc
d0ad78e
 
 
 
 
2e910dc
d0ad78e
 
17fe721
 
 
 
 
 
be0722d
7edaf74
 
17fe721
2e910dc
be0722d
ccf7bb3
d0ad78e
be0722d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Use lightweight Python image
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Pre-download model into app folder (readable by the app process)
RUN mkdir -p /tmp/huggingface
RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
    model_id='deepseek-ai/DeepSeek-R1'; \
    AutoTokenizer.from_pretrained(model_id, cache_dir='/tmp/huggingface'); \
    AutoModelForCausalLM.from_pretrained(model_id, cache_dir='/tmp/huggingface')"
# Hugging Face cache directory
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface


# Expose FastAPI port
EXPOSE 7860

# Command to run FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]