FROM postgres:15-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends python3-venv curl \
    && python3 -m venv /opt/patroni \
    && /opt/patroni/bin/pip install --no-cache-dir 'patroni[etcd3]==4.1.5' 'psycopg2-binary==2.9.11' \
    && rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/patroni/bin:$PATH"
USER postgres
ENTRYPOINT ["patroni", "/etc/patroni/patroni.yml"]
