FROM python:3.12-alpine

ENV PYTHONUNBUFFERED=1

# Install system dependencies
RUN apk add --no-cache \
    usbutils \
    iproute2 \
    dhcpcd \
    curl \
    ffmpeg \
    gcc \
    musl-dev \
    linux-headers \
    libffi-dev

WORKDIR /app

# Install Python dependencies and strip compiler tools
RUN pip install --no-cache-dir \
    "open-gopro>=0.22.0" \
    aiohttp \
    && apk del gcc musl-dev linux-headers libffi-dev

COPY ingest.py /app/ingest.py
RUN chmod +x /app/ingest.py

CMD ["python3", "/app/ingest.py"]