Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -7
Dockerfile
CHANGED
|
@@ -2,13 +2,18 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
libgomp1 \
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# Copy requirements
|
| 12 |
COPY requirements.txt .
|
| 13 |
|
| 14 |
# Install Python dependencies
|
|
@@ -16,14 +21,14 @@ RUN pip install --no-cache-dir paddlepaddle==3.0.0 && \
|
|
| 16 |
python -m pip install --no-cache-dir paddleocr && \
|
| 17 |
pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
# Copy application
|
| 20 |
COPY app.py .
|
| 21 |
|
| 22 |
-
# Expose port
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
ENV PYTHONUNBUFFERED=1
|
| 27 |
|
| 28 |
-
# Run
|
| 29 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies for OpenCV and PaddleOCR
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
libgl1 \
|
| 8 |
+
libglib2.0-0 \
|
| 9 |
+
libsm6 \
|
| 10 |
+
libxrender1 \
|
| 11 |
+
libxext6 \
|
| 12 |
libgomp1 \
|
| 13 |
+
poppler-utils \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# Copy requirements first (for better caching)
|
| 17 |
COPY requirements.txt .
|
| 18 |
|
| 19 |
# Install Python dependencies
|
|
|
|
| 21 |
python -m pip install --no-cache-dir paddleocr && \
|
| 22 |
pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
+
# Copy application code
|
| 25 |
COPY app.py .
|
| 26 |
|
| 27 |
+
# Expose port (HuggingFace Spaces uses 7860)
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
+
# Set environment variables
|
| 31 |
ENV PYTHONUNBUFFERED=1
|
| 32 |
|
| 33 |
+
# Run the application
|
| 34 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|