Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +8 -10
Dockerfile
CHANGED
|
@@ -6,7 +6,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 6 |
DEBIAN_FRONTEND=noninteractive \
|
| 7 |
PORT=7860
|
| 8 |
|
| 9 |
-
# Install system dependencies (
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
build-essential \
|
| 12 |
tesseract-ocr \
|
|
@@ -17,29 +17,27 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 17 |
git \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
WORKDIR /app
|
| 22 |
-
|
| 23 |
-
# Create a non-root user (Required by Hugging Face Spaces)
|
| 24 |
RUN useradd -m -u 1000 user
|
| 25 |
ENV HOME=/home/user \
|
| 26 |
PATH=/home/user/.local/bin:$PATH
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Copy requirements and install dependencies
|
| 29 |
COPY requirements.txt .
|
| 30 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 31 |
pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
| 32 |
pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
-
# Copy backend code
|
| 35 |
-
COPY --chown=user:user .
|
| 36 |
|
| 37 |
# Switch to non-root user
|
| 38 |
USER user
|
| 39 |
|
| 40 |
-
# Create uploads directory with correct permissions
|
| 41 |
-
RUN mkdir -p /app/uploads
|
| 42 |
-
|
| 43 |
# Expose Hugging Face default port
|
| 44 |
EXPOSE 7860
|
| 45 |
|
|
|
|
| 6 |
DEBIAN_FRONTEND=noninteractive \
|
| 7 |
PORT=7860
|
| 8 |
|
| 9 |
+
# Install system dependencies (Tesseract OCR & Poppler for PDF-to-image)
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
build-essential \
|
| 12 |
tesseract-ocr \
|
|
|
|
| 17 |
git \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
+
# Create a non-root user (Required by Hugging Face Spaces: user 1000)
|
|
|
|
|
|
|
|
|
|
| 21 |
RUN useradd -m -u 1000 user
|
| 22 |
ENV HOME=/home/user \
|
| 23 |
PATH=/home/user/.local/bin:$PATH
|
| 24 |
|
| 25 |
+
# Set working directory and grant full ownership to user 1000
|
| 26 |
+
WORKDIR /app
|
| 27 |
+
RUN mkdir -p /app/uploads && chown -R user:user /app
|
| 28 |
+
|
| 29 |
# Copy requirements and install dependencies
|
| 30 |
COPY requirements.txt .
|
| 31 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 32 |
pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
| 33 |
pip install --no-cache-dir -r requirements.txt
|
| 34 |
|
| 35 |
+
# Copy backend code with user ownership
|
| 36 |
+
COPY --chown=user:user . /app
|
| 37 |
|
| 38 |
# Switch to non-root user
|
| 39 |
USER user
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
# Expose Hugging Face default port
|
| 42 |
EXPOSE 7860
|
| 43 |
|