Yousif Abdulhafiz commited on
Commit
ce8c9bf
·
1 Parent(s): a2b2e3c

Add `pyproject.toml` and `uv.lock` for dependency management configuration

Browse files
Files changed (3) hide show
  1. Dockerfile +18 -6
  2. pyproject.toml +14 -0
  3. uv.lock +0 -0
Dockerfile CHANGED
@@ -8,8 +8,21 @@ RUN apt-get update && apt-get install -y \
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- RUN pip3 install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Route all caches/configs to /app and set HOME for Streamlit and others
15
  ENV HOME=/app \
@@ -18,14 +31,14 @@ ENV HOME=/app \
18
  STREAMLIT_USER_PATH=/app/.streamlit \
19
  STREAMLIT_DISABLE_TELEMETRY=1 \
20
  PYTHONUNBUFFERED=1 \
21
- PIP_NO_CACHE_DIR=1 \
 
 
22
  HF_HOME=/app/.cache/huggingface \
23
  TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers \
24
  TORCH_HOME=/app/.cache/torch \
25
- MPLCONFIGDIR=/app/.config/matplotlib \
26
  XDG_CONFIG_HOME=/app/.config \
27
  XDG_CACHE_HOME=/app/.cache \
28
- # EasyOCR cache dir (Docling may trigger EasyOCR)
29
  EASY_OCR_CACHE_DIR=/app/.EasyOCR
30
 
31
  # Create writable dirs for all caches/configs, including EasyOCR
@@ -33,7 +46,6 @@ RUN mkdir -p \
33
  /app/.streamlit/cache \
34
  /app/.cache/huggingface/transformers \
35
  /app/.cache/torch \
36
- /app/.config/matplotlib \
37
  /app/.config \
38
  /app/.cache \
39
  /app/.EasyOCR \
 
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install uv by copying from the official Docker image
12
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
13
+
14
+ # Copy the project metadata for dependency resolution
15
+ COPY pyproject.toml uv.lock /app/
16
+
17
+ # Install dependencies into a virtual environment
18
+ # Use cache mount for better build performance
19
+ RUN --mount=type=cache,target=/root/.cache/uv \
20
+ cd /app && \
21
+ uv sync --frozen --no-install-project
22
+
23
+ # Set up the virtual environment
24
+ ENV VIRTUAL_ENV=/app/.venv
25
+ ENV PATH="/app/.venv/bin:$PATH"
26
 
27
  # Route all caches/configs to /app and set HOME for Streamlit and others
28
  ENV HOME=/app \
 
31
  STREAMLIT_USER_PATH=/app/.streamlit \
32
  STREAMLIT_DISABLE_TELEMETRY=1 \
33
  PYTHONUNBUFFERED=1 \
34
+ PYTHONDONTWRITEBYTECODE=1 \
35
+ UV_COMPILE_BYTECODE=1 \
36
+ UV_LINK_MODE=copy \
37
  HF_HOME=/app/.cache/huggingface \
38
  TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers \
39
  TORCH_HOME=/app/.cache/torch \
 
40
  XDG_CONFIG_HOME=/app/.config \
41
  XDG_CACHE_HOME=/app/.cache \
 
42
  EASY_OCR_CACHE_DIR=/app/.EasyOCR
43
 
44
  # Create writable dirs for all caches/configs, including EasyOCR
 
46
  /app/.streamlit/cache \
47
  /app/.cache/huggingface/transformers \
48
  /app/.cache/torch \
 
49
  /app/.config \
50
  /app/.cache \
51
  /app/.EasyOCR \
pyproject.toml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "document-hf"
3
+ version = "0.1.0"
4
+ description = "Streamlit app to compare Marker vs Docling PDF extraction"
5
+ readme = "README.md"
6
+ # Python requirement based on docling dependency constraints
7
+ requires-python = ">=3.13"
8
+ dependencies = [
9
+ "docling",
10
+ "marker-pdf",
11
+ "streamlit",
12
+ "st-diff-viewer",
13
+ ]
14
+
uv.lock ADDED
The diff for this file is too large to render. See raw diff