ChintanSatva commited on
Commit
9fe7214
·
verified ·
1 Parent(s): 1760932

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -26
Dockerfile CHANGED
@@ -1,42 +1,35 @@
1
- FROM ubuntu:22.04
 
2
 
3
- # Set time zone to Asia/Kolkata (IST)
4
- ENV TZ=Asia/Kolkata
5
- RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
6
-
7
- # Set cache directories for Hugging Face and Numba
8
- ENV HF_HOME=/app/cache
9
- ENV NUMBA_CACHE_DIR=/app/cache
10
- ENV VLLM_CPU_ONLY=True
11
- RUN mkdir -p /app/cache && chmod -R 777 /app/cache
12
 
13
  # Install system dependencies
14
  RUN apt-get update && apt-get install -y \
15
- python3.10 \
16
- python3-pip \
17
  tesseract-ocr \
18
  libtesseract-dev \
19
  poppler-utils \
20
- libopencv-dev \
21
- tzdata \
22
- && apt-get clean \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
- # Pre-install NumPy to enforce version
26
- RUN pip3 install --no-cache-dir numpy==1.26.4
27
-
28
- # Pre-install torch to avoid vLLM build issues
29
- RUN pip3 install --no-cache-dir torch==2.4.0
30
 
31
  # Install Python dependencies
32
- COPY requirements.txt .
33
- RUN pip3 install --no-cache-dir -r requirements.txt
34
 
35
  # Copy application code
36
- COPY app.py .
 
 
 
 
 
 
 
 
37
 
38
- # Expose port for FastAPI (Hugging Face Spaces default)
39
  EXPOSE 7860
40
 
41
- # Command to run FastAPI
42
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use official Python 3.10 slim image
2
+ FROM python:3.10-slim
3
 
4
+ # Set working directory
5
+ WORKDIR /app
 
 
 
 
 
 
 
6
 
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
 
 
9
  tesseract-ocr \
10
  libtesseract-dev \
11
  poppler-utils \
 
 
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy requirements file
15
+ COPY requirements.txt .
 
 
 
16
 
17
  # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
 
19
 
20
  # Copy application code
21
+ COPY expense.py .
22
+ COPY app.py . # Optional: Include if you want to keep /ocr endpoint
23
+
24
+ # Create cache directory
25
+ RUN mkdir -p /app/cache
26
+
27
+ # Set environment variables
28
+ ENV HF_HOME=/app/cache
29
+ ENV NUMBA_CACHE_DIR=/app/cache
30
 
31
+ # Expose port
32
  EXPOSE 7860
33
 
34
+ # Run FastAPI with expense.py (default: /categorize endpoint)
35
+ CMD ["uvicorn", "expense:app", "--host", "0.0.0.0", "--port", "7860"]