# Use an official Python runtime as a base image | |
FROM python:3.9-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install system dependencies (if any) | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install required Python packages from the requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Install Gunicorn and eventlet | |
RUN pip install gunicorn eventlet | |
# Expose the port the app will run on | |
EXPOSE 7860 | |
# Command to run the application using Gunicorn with eventlet worker | |
CMD ["gunicorn", "-b", "0.0.0.0:7860", "-k", "eventlet", "app:app"] | |