FROM python:3.11-bookworm

# The splitio cpphash extension (mmh3cffi) is compiled from source and needs
# C99. https://github.com/splitio/python-client/issues/219
ENV CFLAGS='-std=c99'

WORKDIR /var/task

RUN --mount=from=ghcr.io/astral-sh/uv:latest,source=/uv,target=/bin/uv \
    --mount=type=bind,source=uv.lock,target=uv.lock \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    uv export --frozen --no-emit-workspace --no-editable -o requirements.txt && \
    uv pip install -r requirements.txt --system

COPY lint-and-test.sh pyproject.toml ./

COPY pythonfeatures/ ./pythonfeatures
COPY tests/ ./tests

ENTRYPOINT [ "/var/task/lint-and-test.sh" ]
