# Use standard lightweight python image
FROM python:3.12-slim

# Set environment paths
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app

# Install system dependencies needed for compiling postgres drivers and netmiko
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    libpq-dev \
    gcc \
    iputils-ping \
    git \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY backend/requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy codebase and assets
COPY backend /app/backend/
COPY demo /app/demo/
COPY acutis-networks-marketing /app/acutis-networks-marketing/
COPY collector /app/collector/
COPY nocloud /app/nocloud/

# Expose FastAPI default port
EXPOSE 8000

# Start server using Uvicorn
CMD ["python", "-m", "uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
