FROM python:3.12-slim

WORKDIR /app

# Install dependencies
COPY pyproject.toml .
RUN pip install --no-cache-dir .

# Copy source
COPY src/ src/
COPY migrations/ migrations/
COPY static/ static/
COPY templates/ templates/

# Expose ports (TCP for HTTP, UDP for collector)
EXPOSE 5500/tcp
EXPOSE 5500/udp

# Run with gunicorn
CMD ["gunicorn", "-b", "0.0.0.0:5500", "esp32_web:create_app()"]
