Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -14
Dockerfile
CHANGED
@@ -1,10 +1,10 @@
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
-
|
4 |
-
USER
|
5 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
7 |
-
# Set non-interactive mode
|
8 |
ENV DEBIAN_FRONTEND=noninteractive
|
9 |
|
10 |
# Fix permission issues by using --allow-releaseinfo-change
|
@@ -15,23 +15,23 @@ RUN apt-get update --allow-releaseinfo-change && \
|
|
15 |
poppler-utils && \
|
16 |
rm -rf /var/lib/apt/lists/* # Clean up
|
17 |
|
18 |
-
#
|
19 |
-
RUN
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
pymupdf \
|
25 |
-
pypdf \
|
26 |
-
unstructured[pdf]
|
27 |
|
28 |
# Set Tesseract OCR path
|
29 |
ENV TESSDATA_PREFIX="/usr/share/tesseract-ocr/4.00/tessdata"
|
30 |
|
|
|
31 |
WORKDIR /app
|
32 |
|
|
|
33 |
COPY --chown=user ./requirements.txt requirements.txt
|
34 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
35 |
|
36 |
-
|
|
|
37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Start from Python 3.9 image
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Switch to root to install system dependencies
|
5 |
+
USER root
|
|
|
6 |
|
7 |
+
# Set non-interactive mode
|
8 |
ENV DEBIAN_FRONTEND=noninteractive
|
9 |
|
10 |
# Fix permission issues by using --allow-releaseinfo-change
|
|
|
15 |
poppler-utils && \
|
16 |
rm -rf /var/lib/apt/lists/* # Clean up
|
17 |
|
18 |
+
# Add a non-root user
|
19 |
+
RUN useradd -m -u 1000 user
|
20 |
+
|
21 |
+
# Switch to the new user
|
22 |
+
USER user
|
23 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
|
|
|
|
|
|
24 |
|
25 |
# Set Tesseract OCR path
|
26 |
ENV TESSDATA_PREFIX="/usr/share/tesseract-ocr/4.00/tessdata"
|
27 |
|
28 |
+
# Set working directory
|
29 |
WORKDIR /app
|
30 |
|
31 |
+
# Copy requirements and install Python packages
|
32 |
COPY --chown=user ./requirements.txt requirements.txt
|
33 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
34 |
|
35 |
+
# Copy application files
|
36 |
+
COPY --chown=user . .
|
37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|