-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 980 Bytes
/
Copy pathDockerfile
File metadata and controls
42 lines (30 loc) · 980 Bytes
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
# Build stage
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies into .venv
RUN uv sync --frozen --no-dev
# Download spaCy models into .venv
RUN .venv/bin/python -m spacy download en_core_web_sm && \
.venv/bin/python -m spacy download pt_core_news_sm
# Runtime stage
FROM python:3.12-slim-bookworm
WORKDIR /app
# Install runtime dependencies (tesseract, languages, and poppler)
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-por \
tesseract-ocr-eng \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY . .
# Expose port
EXPOSE 8080
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH"
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]