Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -7
Dockerfile
CHANGED
|
@@ -7,10 +7,17 @@ RUN apt-get update && apt-get install -y \
|
|
| 7 |
tesseract-ocr-ita tesseract-ocr-fra tesseract-ocr-rus \
|
| 8 |
poppler-utils \
|
| 9 |
libopencv-dev \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
# Copy files
|
|
@@ -24,13 +31,10 @@ RUN if [ ! -f /app/requirements.txt ]; then echo "requirements.txt not found" &&
|
|
| 24 |
RUN if [ ! -f /app/app.py ]; then echo "app.py not found" && exit 1; fi
|
| 25 |
|
| 26 |
# Install Python dependencies
|
|
|
|
| 27 |
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
RUN useradd -m appuser
|
| 31 |
-
USER appuser
|
| 32 |
-
|
| 33 |
-
# Expose port
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
# Run the app
|
|
|
|
| 7 |
tesseract-ocr-ita tesseract-ocr-fra tesseract-ocr-rus \
|
| 8 |
poppler-utils \
|
| 9 |
libopencv-dev \
|
| 10 |
+
libglib2.0-0 \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Set environment variables to avoid permission issues
|
| 14 |
+
ENV XDG_CACHE_HOME=/tmp
|
| 15 |
+
ENV FONTCONFIG_PATH=/tmp
|
| 16 |
+
|
| 17 |
+
# Create temporary directories
|
| 18 |
+
RUN mkdir -p /tmp/fontconfig
|
| 19 |
+
|
| 20 |
+
# Set working directory
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
# Copy files
|
|
|
|
| 31 |
RUN if [ ! -f /app/app.py ]; then echo "app.py not found" && exit 1; fi
|
| 32 |
|
| 33 |
# Install Python dependencies
|
| 34 |
+
RUN pip install --upgrade pip
|
| 35 |
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 36 |
|
| 37 |
+
# Expose Hugging Face Spaces default port
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
# Run the app
|