File size: 733 Bytes
f1f0496
 
92f6026
f1f0496
 
98d686a
 
 
 
 
 
 
92f6026
f1f0496
 
 
92f6026
f1f0496
 
92f6026
 
 
 
f1f0496
 
92f6026
98d686a
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
FROM python:3.10

# Set the working directory
WORKDIR /app

# Set environment variables for Hugging Face cache location
ENV TRANSFORMERS_CACHE=/app/models_cache
ENV HF_HOME=/app/models_cache
ENV HF_DATASETS_CACHE=/app/models_cache
ENV SENTENCE_TRANSFORMERS_HOME=/app/models_cache
ENV XDG_CACHE_HOME=/app/models_cache

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

# Copy the application code
COPY . .

# Ensure the models_cache directory exists and set permissions
RUN mkdir -p /app/models_cache && chmod -R 777 /app/models_cache

# Expose port 7860
EXPOSE 7860

# Run the FastAPI application with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]