# Admin panel image. Build context = project ROOT (needs backend/db.py + admin/).
#   docker build -f admin/Dockerfile -t didvan-admin .
# Keep this OFF public networks (it exposes user PII + the data-source token).
# Base image from Liara's mirror — Docker Hub is blocked from Iran builds.
FROM docker-mirror.liara.ir/library/python:3.12-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONUTF8=1 \
    PIP_NO_CACHE_DIR=1 \
    DB_PATH=/data/asianmetal.db

WORKDIR /app

# admin only needs a few libs (no Playwright/Chromium)
RUN pip install --no-cache-dir fastapi "uvicorn[standard]" pydantic requests python-multipart

# admin_app imports nothing from backend, but copy both so paths line up
COPY admin ./admin
COPY backend ./backend

RUN mkdir -p /data

EXPOSE 8001
CMD ["python", "-m", "uvicorn", "admin_app:app", "--host", "0.0.0.0", "--port", "8001", "--app-dir", "admin"]
