FROM python:3.13.2-slim-bullseye # Install minimal system dependencies and build tools for Python packages RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy only requirements first to leverage Docker cache COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Remove build tools to reduce image size RUN apt-get purge -y --auto-remove \ build-essential \ gcc \ g++ # Copy rest of the app code COPY . . # Create a non-root user for security reasons RUN useradd -m appuser USER appuser # Run the Python application CMD ["python", "sqs_processor.py"]