ysif9 commited on
Commit
60d4343
·
verified ·
1 Parent(s): 67945dd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -18
Dockerfile CHANGED
@@ -1,6 +1,5 @@
1
  FROM python:3.13.5-slim
2
 
3
- # System setup
4
  WORKDIR /app
5
 
6
  RUN apt-get update && apt-get install -y \
@@ -9,11 +8,10 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Install Python dependencies
13
  COPY requirements.txt ./
14
  RUN pip3 install --no-cache-dir -r requirements.txt
15
 
16
- # Environment: ensure Streamlit writes under /app and disable telemetry
17
  ENV HOME=/app \
18
  STREAMLIT_HOME=/app/.streamlit \
19
  STREAMLIT_CACHE_DIR=/app/.streamlit/cache \
@@ -21,26 +19,38 @@ ENV HOME=/app \
21
  STREAMLIT_DISABLE_TELEMETRY=1 \
22
  PYTHONUNBUFFERED=1 \
23
  PIP_NO_CACHE_DIR=1 \
 
24
  TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers \
25
  TORCH_HOME=/app/.cache/torch \
26
- HF_HOME=/app/.cache/huggingface
27
-
28
- # Prepare writable directories
29
- RUN mkdir -p /app/.streamlit/cache \
30
- && chmod -R 777 /app/.streamlit
31
-
32
- # Optionally create XDG dirs to be safe with other libs/tools
33
- ENV XDG_CONFIG_HOME=/app/.config \
34
- XDG_CACHE_HOME=/app/.cache
35
- RUN mkdir -p /app/.config /app/.cache \
36
- && chmod -R 777 /app/.config /app/.cache
37
-
38
- # Copy application code
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  COPY src/ ./src/
40
 
41
- # Networking and healthcheck
42
  EXPOSE 8501
43
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
44
 
45
- # Run Streamlit app
46
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.13.5-slim
2
 
 
3
  WORKDIR /app
4
 
5
  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 \
16
  STREAMLIT_HOME=/app/.streamlit \
17
  STREAMLIT_CACHE_DIR=/app/.streamlit/cache \
 
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
32
+ 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 \
40
+ && chmod -R 777 /app/.streamlit /app/.cache /app/.config /app/.EasyOCR
41
+
42
+ # Fallback for Marker: redirect any site-packages "static" to /app/static (writable)
43
+ RUN mkdir -p /app/static && \
44
+ if [ -e /usr/local/lib/python3.13/site-packages/static ]; then \
45
+ rm -rf /usr/local/lib/python3.13/site-packages/static; \
46
+ fi && \
47
+ ln -s /app/static /usr/local/lib/python3.13/site-packages/static && \
48
+ chmod -R 777 /app/static
49
+
50
+ # Copy app
51
  COPY src/ ./src/
52
 
 
53
  EXPOSE 8501
54
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
55
 
 
56
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]