Spaces:
Sleeping
Sleeping
File size: 982 Bytes
9f6aa3c 0ad9cc2 14243c9 83be853 14243c9 14d96da 0ad9cc2 ae6b9c4 0ad9cc2 ae6b9c4 00ff2f5 ae6b9c4 f969157 ae6b9c4 f969157 83be853 ae6b9c4 14243c9 9f6aa3c 6a0670c 9f6aa3c ae6b9c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# Use a slimmer official Python image
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies for PyPDF2, python-pptx, etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Add flask-cors to requirements if not already there
RUN grep -q "flask-cors" requirements.txt || echo "flask-cors" >> requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user to run the application
RUN useradd -m appuser
RUN mkdir -p /app/uploads /app/temp && chown -R appuser:appuser /app
# Copy the entire application
COPY --chown=appuser:appuser . .
# Switch to the non-root user
USER appuser
# Expose the application port
EXPOSE 7860
# Run Gunicorn with logging
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "--timeout", "120", "app:app"] |