| FROM python:3.11 | |
| # Set the working directory | |
| WORKDIR /app | |
| # Update package lists, install dependencies, and clean up to reduce image size | |
| RUN apt update && apt install -y \ | |
| libgl1-mesa-glx \ | |
| curl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file first to leverage Docker caching | |
| COPY requirements.txt ./ | |
| # Install Python dependencies with upgraded pip | |
| RUN python3 -m pip install --upgrade pip && \ | |
| python3 -m pip install --no-cache-dir -r requirements.txt && \ | |
| python3 -m pip list | |
| # Environment variables | |
| ENV PYTHONPATH=/app | |
| ENV PYTHONUNBUFFERED=1 | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Set the default command to run your application | |
| CMD ["python3", "handler.py"] | |