# Use a slim Python image
FROM python:3.12-slim

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

# Install system dependencies (Required for Postgres and Healthchecks)
RUN apt-get update && apt-get install -y \
    libpq5 \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy dependency files
COPY pyproject.toml .
# COPY uv.lock . # Uncomment this once you have generated a lockfile locally

# Install dependencies into a system-wide environment
RUN uv pip install --system -r pyproject.toml

# Copy the rest of the application
COPY . .

# Security: Run as a non-privileged user (standard for 24/7 telemetry)
RUN useradd -m telemetry-user
USER telemetry-user

# CMD is handled by docker-compose.yml to differentiate movement vs events