File size: 866 Bytes
9afe470
71cc10e
b555b7e
71cc10e
9afe470
 
 
 
 
39e19ed
 
 
 
 
 
 
 
9afe470
b555b7e
9afe470
 
b172d89
9afe470
 
b172d89
9afe470
 
71cc10e
9afe470
b555b7e
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
FROM python:3.9-slim

WORKDIR /code

# Install system dependencies
RUN apt-get update && apt-get install -y \

    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Set environment variables for cache directories
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets

# Create cache directory with proper permissions
RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface

# Copy requirements and install Python dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \

    pip install --no-cache-dir -r /code/requirements.txt

# Copy application code
COPY ./app.py /code/app.py

# Expose port
EXPOSE 7860

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