# Build context must be the frugal-sdk-python repo root so we can COPY both the
# SDK source and the examples/test-env/sample-app/ tree.
FROM python:3.12-slim

ENV PYTHONUNBUFFERED=1 \
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
  PIP_NO_CACHE_DIR=1

# Install the SDK in editable mode so caller_file paths resolve against the
# repo-relative path and not site-packages.
COPY pyproject.toml /frugal-sdk-python/
COPY README.md /frugal-sdk-python/
COPY src /frugal-sdk-python/src
RUN pip install /frugal-sdk-python/

WORKDIR /frugal-sdk-python/examples/test-env/sample-app
COPY examples/test-env/sample-app/requirements.txt ./
RUN pip install -r requirements.txt
COPY examples/test-env/sample-app/pyproject.toml ./
COPY examples/test-env/sample-app/app ./app

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