Repository navigation
build: Docker base images built here and pushed on release - #21
Merged
Merged
Conversation
The base images WN-Sense builds FROM (django-whiteneuron-{alpine,debian}
:v<version>) were built in WN-Sense from a git+https install of a tag.
They now live with the package:
- docker/Dockerfile.base-{alpine,debian}: install the package from the
build context (bind mount, no source layer), run as appuser (/app) like
before, and fail if WHITENEURON_VERSION != the installed version.
Alpine build tools are a virtual package removed in the same layer.
- docker/build-base.sh / push-base.sh: same variables as WN-Sense
(IMAGE_NAMESPACE, PYTHON_VERSION, PLATFORM) plus GIT_REF and VARIANTS;
the context is 'git archive' of the ref, so local files (db.sqlite3,
dist/, node_modules) never reach an image; the tag defaults to
v<pyproject version at that ref>.
- .github/workflows/docker-base.yml: on a published GitHub Release, build
and push both images with provenance + SBOM (tag must equal the
pyproject version); manual runs for any ref; PRs touching docker/
build only. Needs DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets.
- .dockerignore allowlist; README / CHANGELOG / release notes.
- Dependencies pinned from the ref's uv.lock (uv export -> docker-requirements.txt), so images match what CI tests and a tag always rebuilds the same set (unpinned, 49 of 97 packages drifted, e.g. openai 2 -> 3). - Pushing requires GIT_REF to be the release tag v<version> (and a clean docker/), so a published tag can't be overwritten with other code; the version check compares normalized versions. - The workflow runs docker/build-base.sh (one build path; Dockerfiles from the checkout, so older tags build too) and no longer uses a write-only GHA cache. - Variants validated before the first build; PUSH=1 uses a docker-container builder when the current one can't attest. - WN_PYTHON_VERSION / WN_PLATFORM (python images export PYTHON_VERSION); the tag is always v<version> (no WHITENEURON_VERSION override). - AUTOBAHN_USE_NVX=0 only while installing; DEBIAN_FRONTEND as ARG; no redundant ca-certificates; Alpine build deps reduced to gcc musl-dev; appuser pinned to uid 100 / gid 101 (the ids earlier images got) and USER is numeric.
…on; release notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The base images WN-Sense builds
FROMareanhneuron/django-whiteneuron-{alpine,debian}:v<version>. Until now they were built in WN-Sense (docker/build-base.sh,push-base.sh,Dockerfile.base-*) from agit+https://…@taginstall. This PR moves that flow into this repository and publishes the images automatically when a GitHub Release is published.Image names, tag format (
v<version>), userappuser(home/app) andTZare unchanged, so WN-Sense only needsBASE=v0.4.0.0indocker/.versions.What's added
docker/Dockerfile.base-{alpine,debian}uv.lock, the same set CI tests. Without pinning, today's build would get 49 of 97 packages at untested versions, e.g. openai 2 → 3 and django-debug-toolbar 7 → 8.appuseris pinned to uid 100 / gid 101, the ids earlier images got, so existing volumes stay writable.USERis numeric sorunAsNonRootcan verify it.gcc musl-dev) andAUTOBAHN_USE_NVX=0only exist while installing. Debian:DEBIAN_FRONTENDis anARG, so it doesn't leak into downstream images.docker/build-base.sh(andpush-base.sh=PUSH=1) is the only build path; CI uses it too.git archiveofGIT_REF, so local files (db.sqlite3,dist/,node_modules) never reach an image.uv.lock, viauv export.GIT_REFto be the release tagv<version>and a cleandocker/. A published tag can't be overwritten with other code: pushingHEAD, orv0.3.5.3(whose pyproject says0.3.5.2), is refused with a clear message.PUSH=1creates adocker-containerbuilder when the current builder can't attach provenance/SBOM.WN_PYTHON_VERSION/WN_PLATFORM, because python images export their ownPYTHON_VERSION..github/workflows/docker-base.ymlpython-publish.yml(PyPI).docker/,pyproject.tomloruv.lock: build only. This PR runs it, which checks theapk/aptsteps..dockerignoreallowlist; README (Building & Releasing → Docker base images), CHANGELOG and v0.4.0.0 release notes.Setup needed once
Add the repository secrets
DOCKERHUB_USERNAMEandDOCKERHUB_TOKEN(a Docker Hub access token with write access). The optional repository variableDOCKERHUB_NAMESPACEchanges the namespace (defaultanhneuron).Validation
apk/aptlines were dropped for that run; PyPI was reachable. This PR's CI covers the full Dockerfiles.django-whiteneuron 0.4.0.0, Django 6.0.8, django-unfold 0.109.0 and openai 2.44.0, matchinguv.lock.pip checkis clean. The process runs asuid=100(appuser) gid=101, the compiled CSS, monitoring templates and.mofiles are present, and there is no/tmp/srcordb.sqlite3.WHITENEURON_VERSION, the build fails with "… but the source is 0.4.0.0".docker):HEADis refused;v0.3.5.3is refused (tag vs. pyproject mismatch);docker/blocks a push;v0.3.8.0builds with its ownuv.lock(Django 6.0.8, django-unfold 0.99.1);PYTHON_VERSIONis ignored.actionlintreports no issues in either workflow. The rebuiltstyles.cssis unchanged.Follow-up in WN-Sense (not part of this PR)
Once this has published
v0.4.0.0:BASE=v0.4.0.0indocker/.versions;build-base.sh,push-base.shandDockerfile.base-*;docker-push.sh, drop thepush-base.shcall thatPUSH_MODE=attestedmakes forTARGET=all.