-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 1.15 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (26 loc) · 1.15 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
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
tesseract-ocr tesseract-ocr-eng poppler-utils libmagic1 curl \
build-essential gcc g++ \
&& rm -rf /var/lib/apt/lists/*
# Install uv globally
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
&& mv /root/.local/bin/uv /usr/local/bin/uv \
&& mv /root/.local/bin/uvx /usr/local/bin/uvx
# Copy pyproject.toml and README.md first to leverage Docker cache for dependencies
COPY pyproject.toml README.md ./
# Create venv and install non-editable dependencies (this layer will be cached if pyproject.toml doesn't change)
RUN uv venv && /usr/local/bin/uv pip install . --system
# Copy application code and tests
COPY app/ ./app/
COPY tests/ ./tests/
# Perform editable install for the application code
RUN /usr/local/bin/uv pip install -e . --python /app/.venv/bin/python --system
# Create necessary directories
RUN mkdir -p bucket sample_docs
EXPOSE 8000
ENV PYTHONPATH=/app
ENV PATH="/app/.venv/bin:$PATH"
CMD bash -c "source /app/.venv/bin/activate && python3 -c 'import transformers' && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"