|
|
|
FROM python:3.10-slim |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
libopenblas-dev \ |
|
libomp-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN mkdir -p /tmp/huggingface_cache /tmp/matplotlib \ |
|
&& chmod -R 777 /tmp/huggingface_cache /tmp/matplotlib |
|
|
|
|
|
ENV HF_HOME=/tmp |
|
ENV TRANSFORMERS_CACHE=/tmp |
|
ENV MPLCONFIGDIR=/tmp |
|
|
|
|
|
COPY requirements.txt /app/requirements.txt |
|
|
|
|
|
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu |
|
|
|
|
|
COPY . /app |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["python", "main.py"] |
|
|