FROM python:3.12-slim

# Install graphviz for PNG rendering
RUN apt-get update && apt-get install -y --no-install-recommends \
    graphviz \
    openssh-client \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

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

# Copy all Python modules
COPY config.py db.py parser.py ssh_client.py scanner.py exports.py app.py nocodb_client.py ./

# Copy frontend template
COPY index.html ./templates/index.html

# Create static and data dirs
RUN mkdir -p ./static /data

# Data volume for SQLite + exports
VOLUME ["/data"]

EXPOSE 5000

CMD ["python", "app.py"]
