# Handler Base Image # # Provides a pre-built base with all common dependencies for handler services. # Services extend this image and add their specific code. # # Build: # docker build -t ghcr.io/billy-davies-2/handler-base:latest . # # Usage in child Dockerfile: # FROM ghcr.io/billy-davies-2/handler-base:latest # COPY my_handler.py . # CMD ["python", "my_handler.py"] FROM python:3.13-slim AS base WORKDIR /app # Install uv for fast, reliable package management COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* # Copy and install handler-base package COPY pyproject.toml README.md ./ COPY handler_base/ ./handler_base/ # Install the package with all dependencies RUN uv pip install --system --no-cache . # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Default health check HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Default command (override in child images) CMD ["python", "-c", "print('handler-base ready')"] # Audio variant with soundfile, librosa, webrtcvad FROM base AS audio RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libsndfile1 \ gcc \ python3-dev \ && rm -rf /var/lib/apt/lists/* RUN uv pip install --system --no-cache \ soundfile>=0.12.0 \ librosa>=0.10.0 \ webrtcvad>=2.0.10