Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -10
Dockerfile
CHANGED
@@ -7,24 +7,30 @@ WORKDIR /app
|
|
7 |
# Install system dependencies for PyPDF2, python-pptx, etc.
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
gcc \
|
|
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
# Copy requirements file
|
13 |
-
COPY requirements.txt .
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
19 |
|
20 |
-
#
|
21 |
-
RUN
|
|
|
22 |
|
23 |
# Copy the entire application
|
24 |
-
COPY . .
|
|
|
|
|
|
|
25 |
|
26 |
# Expose the application port
|
27 |
EXPOSE 7860
|
28 |
|
29 |
# Run Gunicorn with logging
|
30 |
-
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"]
|
|
|
7 |
# Install system dependencies for PyPDF2, python-pptx, etc.
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
gcc \
|
10 |
+
python3-dev \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Copy requirements file
|
14 |
+
COPY requirements.txt .
|
15 |
+
|
16 |
+
# Add flask-cors to requirements if not already there
|
17 |
+
RUN grep -q "flask-cors" requirements.txt || echo "flask-cors" >> requirements.txt
|
18 |
|
19 |
+
# Install Python dependencies
|
20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
21 |
|
22 |
+
# Create a non-root user to run the application
|
23 |
+
RUN useradd -m appuser
|
24 |
+
RUN mkdir -p /app/uploads /app/temp && chown -R appuser:appuser /app
|
25 |
|
26 |
# Copy the entire application
|
27 |
+
COPY --chown=appuser:appuser . .
|
28 |
+
|
29 |
+
# Switch to the non-root user
|
30 |
+
USER appuser
|
31 |
|
32 |
# Expose the application port
|
33 |
EXPOSE 7860
|
34 |
|
35 |
# Run Gunicorn with logging
|
36 |
+
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "--timeout", "120", "app:app"]
|