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 mapper modules
COPY mapper/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY mapper/ ./
COPY web/app.py ./
COPY web/templates/ ./templates/
COPY web/static/ ./static/

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

EXPOSE 5000

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