LogicGoInfotechSpaces commited on
Commit
1a521a2
·
verified ·
1 Parent(s): 5bfda4e

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -------------------------------------------------------------
2
+ # Build Stage
3
+ # -------------------------------------------------------------
4
+ FROM python:3.10-slim AS build
5
+
6
+ # Prevents Python from buffering stdout/stderr
7
+ ENV PYTHONUNBUFFERED=1
8
+
9
+ # Install system dependencies required for OCR + OpenCV
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ build-essential \
12
+ libglib2.0-0 \
13
+ libsm6 \
14
+ libxext6 \
15
+ libxrender-dev \
16
+ libgl1 \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Create app directory
20
+ WORKDIR /app
21
+
22
+ # Copy requirements
23
+ COPY requirements.txt .
24
+
25
+ # Install Python dependencies
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
+
28
+ # -------------------------------------------------------------
29
+ # Final Image Stage
30
+ # -------------------------------------------------------------
31
+ FROM python:3.10-slim
32
+
33
+ ENV PYTHONUNBUFFERED=1
34
+
35
+ RUN apt-get update && apt-get install -y --no-install-recommends \
36
+ libglib2.0-0 \
37
+ libsm6 \
38
+ libxext6 \
39
+ libxrender-dev \
40
+ libgl1 \
41
+ && rm -rf /var/lib/apt/lists/*
42
+
43
+ WORKDIR /app
44
+
45
+ COPY --from=build /usr/local /usr/local
46
+
47
+ # Copy your FastAPI app
48
+ COPY app.py .
49
+
50
+ # Expose port 7860 (HuggingFace default)
51
+ EXPOSE 7860
52
+
53
+ # Start FastAPI server
54
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]