Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +37 -43
Dockerfile
CHANGED
|
@@ -1,43 +1,37 @@
|
|
| 1 |
-
FROM python:3.10-slim
|
| 2 |
-
|
| 3 |
-
# Install system dependencies
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
tesseract-ocr \
|
| 7 |
-
tesseract-ocr-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
RUN
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
RUN
|
| 28 |
-
|
| 29 |
-
#
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
EXPOSE 8000
|
| 40 |
-
|
| 41 |
-
# Run the app
|
| 42 |
-
|
| 43 |
-
CMD \["uvicorn", "ocr_api:app", "--host", "0.0.0.0", "--port", "8000"\]
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
tesseract-ocr \
|
| 6 |
+
tesseract-ocr-eng tesseract-ocr-hin tesseract-ocr-ara tesseract-ocr-spa \
|
| 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 |
+
# Create working directory
|
| 13 |
+
RUN mkdir -p /app
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copy files
|
| 17 |
+
COPY . /app/
|
| 18 |
+
|
| 19 |
+
# Debug: List files
|
| 20 |
+
RUN ls -la /app
|
| 21 |
+
|
| 22 |
+
# Verify files
|
| 23 |
+
RUN if [ ! -f /app/requirements.txt ]; then echo "requirements.txt not found" && exit 1; fi
|
| 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 |
+
# Create non-root user
|
| 30 |
+
RUN useradd -m appuser
|
| 31 |
+
USER appuser
|
| 32 |
+
|
| 33 |
+
# Expose port
|
| 34 |
+
EXPOSE 8000
|
| 35 |
+
|
| 36 |
+
# Run the app
|
| 37 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|