File size: 1,215 Bytes
90ab911 b0114f5 6943e92 b0114f5 5e32d01 b0114f5 90ab911 b0114f5 60dd7db 90ab911 6b182f5 90ab911 6b182f5 90ab911 6b182f5 90ab911 6b182f5 5e32d01 6b182f5 b0114f5 60dd7db b0114f5 60dd7db b0114f5 ce74c4f b0114f5 |
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 47 48 49 50 51 52 53 |
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH=/app/src
ENV HF_HOME=/data/hf_cache
ENV TRANSFORMERS_CACHE=/data/hf_cache/txagent_models
ENV MPLCONFIGDIR=/tmp/matplotlib
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
libpoppler-cpp-dev \
&& rm -rf /var/lib/apt/lists/*
# Create and set working directory
WORKDIR /app
# Install base packages
RUN pip install --no-cache-dir \
packaging \
setuptools \
wheel \
numpy
# Install PyTorch with CUDA support (Hugging Face Spaces provides CUDA)
RUN pip install --no-cache-dir \
torch \
transformers \
sentence-transformers \
vllm
# Create necessary directories
RUN mkdir -p /data/hf_cache/txagent_models \
/data/hf_cache/tool_cache \
/data/hf_cache/cache \
/data/hf_cache/reports \
/tmp/matplotlib
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Expose port
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |