-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 1.21 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (33 loc) · 1.21 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
# ==============================================================================
# Stage 1: Builder — compile Python dependencies
# ==============================================================================
FROM python:3.11-slim AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ==============================================================================
# Stage 2: Runtime — lean production image
# ==============================================================================
FROM python:3.11-slim
WORKDIR /app
# Install only runtime system dependencies (no build-essential)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ffmpeg \
tesseract-ocr \
tesseract-ocr-por \
tesseract-ocr-eng \
poppler-utils \
libmagic1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy pre-built Python packages from builder stage
COPY --from=builder /install /usr/local
COPY . .
# Ensure start.sh is executable
RUN chmod +x start.sh
EXPOSE 8000
CMD ["./start.sh"]