prthm11 commited on
Commit
368ab98
·
verified ·
1 Parent(s): baf138d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -0
Dockerfile CHANGED
@@ -77,8 +77,10 @@ ENV DEBIAN_FRONTEND=noninteractive \
77
  # Force CPU-only for PyTorch/transformers
78
  CUDA_VISIBLE_DEVICES= \
79
  PYTORCH_ENABLE_MPS=0 \
 
80
  PYTORCH_NO_CUDA=1
81
 
 
82
  # Copy only what's needed (avoid duplicate COPY . /app)
83
  COPY requirements.txt ./requirements.txt
84
  COPY app.py ./app.py
@@ -89,6 +91,8 @@ COPY generated_projects/ ./generated_projects/
89
 
90
  # Install system dependencies (minimal for CPU inference + common tools)
91
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
 
92
  build-essential \
93
  curl \
94
  ca-certificates \
@@ -101,6 +105,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
101
  poppler-utils \
102
  && apt-get clean && rm -rf /var/lib/apt/lists/*
103
 
 
 
 
 
 
104
  # Python deps
105
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
106
 
@@ -110,6 +119,13 @@ RUN mkdir -p /app/nltk_data /app/.config/matplotlib \
110
  && mkdir -p /app/outputs/DETECTED_IMAGE /app/outputs/SCANNED_IMAGE /app/outputs/EXTRACTED_JSON \
111
  && chown -R root:root /app \
112
  && chmod -R 755 /app/cache /app/data /app/logs /app/outputs
 
 
 
 
 
 
 
113
 
114
  # Set Flask env
115
  ENV FLASK_APP=app.py \
 
77
  # Force CPU-only for PyTorch/transformers
78
  CUDA_VISIBLE_DEVICES= \
79
  PYTORCH_ENABLE_MPS=0 \
80
+ XDG_CACHE_HOME=/app/.cache \
81
  PYTORCH_NO_CUDA=1
82
 
83
+
84
  # Copy only what's needed (avoid duplicate COPY . /app)
85
  COPY requirements.txt ./requirements.txt
86
  COPY app.py ./app.py
 
91
 
92
  # Install system dependencies (minimal for CPU inference + common tools)
93
  RUN apt-get update && apt-get install -y --no-install-recommends \
94
+ fontconfig \
95
+ fonts-dejavu-core \
96
  build-essential \
97
  curl \
98
  ca-certificates \
 
105
  poppler-utils \
106
  && apt-get clean && rm -rf /var/lib/apt/lists/*
107
 
108
+ RUN python -c "import nltk; \
109
+ nltk.download('punkt', download_dir='/app/nltk_data'); \
110
+ nltk.download('averaged_perceptron_tagger', download_dir='/app/nltk_data'); \
111
+ nltk.download('wordnet', download_dir='/app/nltk_data')"
112
+
113
  # Python deps
114
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
115
 
 
119
  && mkdir -p /app/outputs/DETECTED_IMAGE /app/outputs/SCANNED_IMAGE /app/outputs/EXTRACTED_JSON \
120
  && chown -R root:root /app \
121
  && chmod -R 755 /app/cache /app/data /app/logs /app/outputs
122
+
123
+ RUN mkdir -p /app/.config/matplotlib \
124
+ /app/cache /app/nltk_data /nltk_data \
125
+ /app/.cache/fontconfig /root/.cache/fontconfig \
126
+ && chmod -R 777 /app/.config/matplotlib /app/.cache /app/cache /app/nltk_data /nltk_data /root/.cache/fontconfig
127
+
128
+ RUN fc-cache -f -v || true
129
 
130
  # Set Flask env
131
  ENV FLASK_APP=app.py \