File size: 1,126 Bytes
2e77991 9cc6459 2e77991 3050408 2e77991 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# Base Image
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
# System Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
libopenblas-dev \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Hugging Face + model tools
RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate sacremoses
# Hugging Face cache environment (using /tmp for runtime downloads)
ENV HF_HOME=/tmp/huggingface \
TRANSFORMERS_CACHE=/tmp/huggingface \
HUGGINGFACE_HUB_CACHE=/tmp/huggingface \
HF_HUB_CACHE=/tmp/huggingface
# Create cache dir with proper permissions (using /tmp for Hugging Face Spaces)
RUN mkdir -p /tmp/huggingface && \
chmod -R 777 /tmp/huggingface
# Models will be downloaded at runtime to avoid exceeding storage limit
# Copy project files
COPY . .
# Expose agent port
EXPOSE 7860
CMD ["python", "app.py"]
|