Praful Nayak
Deploy Flask Summarization App
8cf911d
raw
history blame
897 Bytes
# Use a lightweight Python image
FROM python:3.9-slim
# Install system dependencies as root
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
zlib1g-dev \
tesseract-ocr \
libtesseract-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user and set environment
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements file and install Python dependencies as user
COPY --chown=user:user requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=user:user . /app
# Expose the necessary port
EXPOSE 7860
# Run the Flask app using Gunicorn with a higher timeout
CMD ["gunicorn", "--workers", "2", "--timeout", "300", "--bind", "0.0.0.0:7860", "app:app"]