# containers/pypi/Containerfile
# keelcore-standards PyPI build image: CPython (.python-version) and the
# hash-locked build tooling (scripts/release/pypi/requirements-build.txt),
# installed once at build time. scripts/release/pypi-publish.sh builds the wheel
# and sdist in it (make release-pypi) with nothing else installed.
# Build context: the repository root.

FROM python:3.12.15-slim-trixie@sha256:a0f57064cbdcd6285fa45f51237ab0b35ea8ebaed06a1f5973e89e19dfb86704

RUN apt-get update \
 && apt-get install -y --no-install-recommends git \
 && rm -rf /var/lib/apt/lists/*

COPY scripts/release/pypi/requirements-build.txt /opt/keelcore/requirements-build.txt
RUN python -m pip install --no-cache-dir --require-hashes --no-deps -r /opt/keelcore/requirements-build.txt

ENV KEELCORE_DEV_IMAGE=1

# The repository is mounted from the host (another owner); git trusts it.
RUN git config --system safe.directory '*'

WORKDIR /work
