Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -16
Dockerfile
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
-
|
|
|
13 |
|
14 |
# Install Python dependencies
|
15 |
-
COPY requirements.txt .
|
16 |
-
RUN pip install --no-cache-dir --upgrade pip
|
17 |
-
|
18 |
|
19 |
# Copy the application code
|
20 |
COPY . .
|
21 |
|
22 |
-
# Expose the port for
|
23 |
EXPOSE 7860
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
# Run the application
|
29 |
-
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use optimized Python image
|
2 |
+
FROM python:3.9-slim
|
3 |
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install required system dependencies for OCR & PDFs
|
8 |
+
RUN apt-get update && apt-get install -y \
|
9 |
+
tesseract-ocr \
|
10 |
+
poppler-utils \
|
11 |
+
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Set environment variables for Hugging Face cache
|
14 |
+
ENV HF_HOME=/tmp/cache
|
15 |
+
RUN mkdir -p /tmp/cache && chmod 777 /tmp/cache
|
16 |
|
17 |
# Install Python dependencies
|
18 |
+
COPY requirements.txt requirements.txt
|
19 |
+
RUN pip install --no-cache-dir --upgrade pip
|
20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
# Copy the application code
|
23 |
COPY . .
|
24 |
|
25 |
+
# Expose the port for API access
|
26 |
EXPOSE 7860
|
27 |
|
28 |
+
# Use Gunicorn for production
|
29 |
+
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|