ARG CONTAINER_PROXY
FROM ${CONTAINER_PROXY}python:3.9-bullseye AS build

ENV PYTHONDONTWRITEBYTECODE="1" \
    PYTHONUNBUFFERED="1"

WORKDIR /build/

# hadolint ignore=DL3013
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel

COPY requirements.txt ./

RUN python3 -m pip install --no-cache-dir -r requirements.txt

# dyff.client dependencies for prototyping
RUN python3 -m pip install --no-cache-dir \
    absl-py \
    azure-core \
    httpx \
    isodate \
    jsonpath-ng \
    pandas \
    pyarrow \
    "pydantic<2"
# /dyff.client

ARG CONTAINER_PROXY
FROM ${CONTAINER_PROXY}python:3.9-slim-bullseye

COPY --from=build /usr/local/ /usr/local/

ENV PYTHONDONTWRITEBYTECODE="1" \
    PYTHONUNBUFFERED="1"

WORKDIR /dyff-api/

COPY dyff/api/ ./dyff/api/
# dyff.client dependencies for prototyping
COPY dyff/audit ./dyff/audit/
COPY dyff/client ./dyff/client/
# /dyff.client
COPY dyff/core/ ./dyff/core/
COPY dyff/web/ ./dyff/web/
COPY scripts/ ./scripts/

ENTRYPOINT ["uvicorn", "dyff.api.server_insecure:app", "--proxy-headers", "--host", "0.0.0.0"]
