FROM python:3.10-slim | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
tesseract-ocr \ | |
libtesseract-dev \ | |
poppler-utils \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy requirements file | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Create cache directory | |
RUN mkdir -p /app/cache | |
# Copy application code | |
COPY expense.py . | |
# Set environment variables for cache | |
ENV HF_HOME=/app/cache | |
ENV NUMBA_CACHE_DIR=/app/cache | |
# Expose port | |
EXPOSE 7860 | |
# Run FastAPI with Uvicorn | |
CMD ["uvicorn", "expense:app", "--host", "0.0.0.0", "--port", "7860"] |