Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -26
Dockerfile
CHANGED
@@ -1,36 +1,17 @@
|
|
1 |
-
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Install
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
-
|
7 |
-
tesseract-ocr \
|
8 |
-
libtesseract-dev \
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
-
# Create a non-root user
|
12 |
-
RUN useradd -m appuser
|
13 |
-
|
14 |
-
# Set working directory
|
15 |
WORKDIR /app
|
16 |
-
|
17 |
-
# Copy requirements.txt and install Python dependencies
|
18 |
COPY requirements.txt .
|
19 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
COPY templates /app/templates/
|
24 |
-
|
25 |
-
# Switch to non-root user
|
26 |
-
USER appuser
|
27 |
-
|
28 |
-
EXPOSE 7860
|
29 |
-
|
30 |
-
ENV PYTHONUNBUFFERED=1
|
31 |
-
ENV FLASK_APP=app.py
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
# Timeout is for a single request/response cycle. Streaming should keep this alive.
|
36 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--worker-class", "gevent", "--timeout", "300", "app:app"]
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
# Install wkhtmltopdf and dependencies
|
4 |
RUN apt-get update && apt-get install -y \
|
5 |
+
wkhtmltopdf \
|
|
|
|
|
6 |
&& rm -rf /var/lib/apt/lists/*
|
7 |
|
|
|
|
|
|
|
|
|
8 |
WORKDIR /app
|
|
|
|
|
9 |
COPY requirements.txt .
|
10 |
RUN pip install --no-cache-dir -r requirements.txt
|
11 |
+
COPY . .
|
12 |
|
13 |
+
# Ensure the temp directory is writable
|
14 |
+
RUN mkdir -p /app/temp && chmod -R 777 /app/temp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
ENV PORT=7860
|
17 |
+
CMD ["python", "app.py"]
|
|
|
|