-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdockerfile
More file actions
64 lines (52 loc) · 1.73 KB
/
dockerfile
File metadata and controls
64 lines (52 loc) · 1.73 KB
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
54
55
56
57
58
59
60
61
62
63
# =========================================
# 🐍 Base Image
# =========================================
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# =========================================
# 🧱 Install system-level dependencies
# =========================================
# Required for lxml, pdf tools, tesseract, python-docx, and opencv
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
git \
libxml2-dev \
libxslt1-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
tesseract-ocr \
poppler-utils \
antiword \
libgl1 \
libglib2.0-0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# =========================================
# 📦 Python Dependencies
# =========================================
COPY cv-req.txt /app/cv-req.txt
# Install pip first (but avoid breaking textract-tr)
RUN pip install --no-cache-dir --upgrade "pip<24.1" wheel setuptools
ENV PIP_NO_CACHE_DIR=1
ENV TMPDIR=/mnt/docker/tmp
RUN mkdir -p /mnt/docker/tmp
RUN pip install --progress-bar off mediapipe opencv-python
RUN pip install --progress-bar off -r /app/cv-req.txt
# =========================================
# 📁 Copy Application Code
# =========================================
COPY . /app
# Make imports work properly
ENV PYTHONPATH=/app
# =========================================
# 🌐 Expose FastAPI port
# =========================================
EXPOSE 8000
# =========================================
# 🚀 Start FastAPI App
# =========================================
# Note: --reload is NOT recommended in production
CMD [ "uvicorn", "apps.api.app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]