Skip to content

feat: an image for stacks with no Python in them - #38

Closed
AlexeyShalaev wants to merge 1 commit into
feat/cli-applyfrom
feat/container-image
Closed

AlexeyShalaev wants to merge 1 commit into
feat/cli-applyfrom
feat/container-image

Conversation

@AlexeyShalaev

Copy link
Copy Markdown
Member

Part 2 of #32: ghcr.io/bedrock-python/pg-partsmith.

The entrypoint is the command itself, so a Compose service or a CronJob names only what it wants done. It runs as UID 65532, and the venv is built in a stage that is thrown away — pip, the build backend and every __pycache__ with it.

Size is treated as a feature. It is checked against a budget on every pull request and a regression fails the build. Measured locally: 244 MB on python:3.13-slim, budget 280 MB. Alpine would be smaller, and I deliberately did not take it: the test suite runs on glibc, and shipping operators a musl build nothing in CI exercises is not a trade worth ~120 MB.

Published from the release workflow with the version off the tag, as the exact version and a moving minor. Never latest — a scheduled job following it would cross a major on its own, at 02:15, with DROP in its hands. CI refuses to publish an image whose --version disagrees with its tag, which is the "one number" promise made mechanical. Trivy scans on both the pull request and the release.

On the epic's base-image-rebuild wrinkle: I have not implemented a -r1 scheme yet, since nothing needs it until the first CVE lands. Worth deciding before it does.

The operator page states what this container can do to a database — it issues DDL — with the minimum grants for the read-only commands, and the wider ones detach and drop need. It also says plainly that plan executes any SqlPredicate in a retention rule: read-only, but your statement, running with these credentials.

ghcr.io/bedrock-python/pg-partsmith runs the CLI as its entrypoint, so a Go,
Ruby or Node service maintains its partitions from a CronJob, a Compose
service or an init container without taking a Python dependency.

Size is the first thing a team evaluating this reads, so it is a build
failure and not a note: the venv is built in a stage that is thrown away --
pip, the build backend and every __pycache__ with it -- and CI checks the
result against a budget on every pull request. It runs as UID 65532 and the
image is scanned on both the pull request and the release.

The image is published from the release workflow with the version off the
tag, as the exact version and a moving minor, and never as latest: a
scheduled job following latest would cross a major on its own, at 02:15,
with DROP in its hands. CI refuses to publish an image whose --version
disagrees with the tag it is being pushed under.

The init-container case needs no flag: apply without --allow-destructive
creates and retires nothing. The operator page states the grants this thing
needs and asks for a dedicated role, because it issues DDL and nobody should
have to work that out from the source.
@AlexeyShalaev

Copy link
Copy Markdown
Member Author

Folded into #43, one PR for the whole epic; this branch stays for history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant