# ============================================================
# Core Platform Service - Dockerfile
# Build context: ریشه مخزن (برای دسترسی به backend/shared-lib)
# ============================================================
FROM python:3.11-slim AS base

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

WORKDIR /app

RUN apt-get update \
    && apt-get install -y --no-install-recommends build-essential libpq-dev \
    && rm -rf /var/lib/apt/lists/*

COPY backend/shared-lib/ /shared-lib/
COPY backend/core-service/requirements.txt /app/requirements.txt

RUN sed -i 's#-e ../shared-lib#-e /shared-lib#' /app/requirements.txt \
    && pip install --upgrade pip \
    && pip install -r requirements.txt

COPY backend/core-service/ /app/

EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
