# Minimal image containing only the pgcommon-migrate CLI — for use as a Kubernetes init
# container or a CI/CD pre-deploy job. This is a utility image, not an application server.
# See README.md's "Migrations" section for the deployment patterns this is meant for.

FROM python:3.14-slim AS build

WORKDIR /src
COPY pyproject.toml README.md ./
COPY src ./src

RUN pip install --no-cache-dir build==1.2.2 && python -m build --wheel

FROM python:3.14-slim

RUN useradd --no-create-home --shell /usr/sbin/nologin migrate
COPY --from=build /src/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl

USER migrate
ENTRYPOINT ["pgcommon-migrate"]
CMD ["--help"]
