Update Dockerfile
Browse files- Dockerfile +12 -4
Dockerfile
CHANGED
@@ -5,7 +5,11 @@ ENV PYTHONUNBUFFERED=1 \
|
|
5 |
MDR_MODEL_DIR=/models \
|
6 |
MDR_DEVICE=cpu \
|
7 |
MDR_TABLE_FORMAT=MARKDOWN \
|
8 |
-
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Set the working directory in the container
|
11 |
WORKDIR /app
|
@@ -31,9 +35,13 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
31 |
COPY mdr_pdf_parser.py .
|
32 |
COPY main.py .
|
33 |
|
34 |
-
# Create the default model directory
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
|
38 |
# Expose the port the app runs on
|
39 |
EXPOSE 8000
|
|
|
5 |
MDR_MODEL_DIR=/models \
|
6 |
MDR_DEVICE=cpu \
|
7 |
MDR_TABLE_FORMAT=MARKDOWN \
|
8 |
+
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
|
9 |
+
# --- ADDED: Point config/cache dirs to writable locations within /app ---
|
10 |
+
MPLCONFIGDIR=/app/.cache/matplotlib \
|
11 |
+
YOLO_CONFIG_DIR=/app/.config/Ultralytics
|
12 |
+
# --- END ADDED ---
|
13 |
|
14 |
# Set the working directory in the container
|
15 |
WORKDIR /app
|
|
|
35 |
COPY mdr_pdf_parser.py .
|
36 |
COPY main.py .
|
37 |
|
38 |
+
# Create the default model directory, temp directory, AND the config/cache dirs
|
39 |
+
# --- MODIFIED: Added creation of the new cache/config dirs ---
|
40 |
+
RUN mkdir -p ${MDR_MODEL_DIR} /app/temp_uploads /app/.cache/matplotlib /app/.config/Ultralytics && \
|
41 |
+
chmod -R 777 ${MDR_MODEL_DIR} /app/temp_uploads /app/.cache /app/.config
|
42 |
+
# Note: chmod 777 is very permissive, but often necessary/easiest in restricted environments like HF Spaces.
|
43 |
+
# It ensures the directories are writable by the user running the application.
|
44 |
+
# --- END MODIFIED ---
|
45 |
|
46 |
# Expose the port the app runs on
|
47 |
EXPOSE 8000
|