-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (32 loc) · 1.05 KB
/
Dockerfile
File metadata and controls
42 lines (32 loc) · 1.05 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
FROM python:3.11-slim
# Install system dependencies (merged from exaOCR and pdfLLM)
RUN apt-get update && apt-get install -y \
libmagic-dev \
poppler-utils \
tesseract-ocr \
tesseract-ocr-eng \
ghostscript \
libreoffice \
fonts-dejavu \
unpaper \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create non-root user for Celery and other services
RUN useradd -m -u 1000 appuser
# Create data and logs directories with correct permissions as root
RUN mkdir -p /app/data/logs && chown -R appuser:appuser /app/data && chmod -R u+rwX /app/data
# Copy requirements and install
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Install spaCy model (from pdfLLM)
RUN python -m spacy download en_core_web_sm
# Copy the entire project
COPY . .
# Set ownership for non-root user
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]