Add OCI standard image labels to Docker images - #2846
Conversation
Add org.opencontainers.image.* labels to all five Dockerfiles (tika-server minimal, tika-server full, tika-grpc) and wire the dynamic labels (version, revision, created) as build-args in both CI workflows (docker-release.yml and docker-snapshot.yml). No changes to Tika itself — Docker metadata only. Signed-off-by: Erwan Hervé <62173453+Erwan-loot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds OCI Image Spec–standard labels to the repository’s published Docker images and wires dynamic label values (revision, created) through the Docker CI workflows, improving registry metadata/provenance without affecting Tika runtime behavior.
Changes:
- Add OCI labels (title/description/source/docs/license/version/revision/created) to the five published Dockerfiles while preserving the existing
maintainerlabel. - Update
docker-snapshot.ymlanddocker-release.ymlto compute git SHA + UTC timestamp and pass them asREVISION/CREATEDbuild args to all Docker builds.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tika-server/docker-build/minimal/Dockerfile.snapshot |
Adds OCI labels and new REVISION/CREATED build args for snapshot minimal server image. |
tika-server/docker-build/minimal/Dockerfile |
Adds OCI labels and new REVISION/CREATED build args for release minimal server image. |
tika-server/docker-build/full/Dockerfile.snapshot |
Adds OCI labels and new REVISION/CREATED build args for snapshot full server image. |
tika-server/docker-build/full/Dockerfile |
Adds OCI labels and new REVISION/CREATED build args for release full server image. |
tika-grpc/docker-build/Dockerfile |
Adds OCI labels and new REVISION/CREATED build args for gRPC image. |
.github/workflows/docker-snapshot.yml |
Captures git SHA + build timestamp and passes as build args to all snapshot image builds. |
.github/workflows/docker-release.yml |
Captures git SHA + build timestamp and passes as build args to all release image builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
We're still using a separate repo for 3.x releases. You're ok with making these changes for our current snapshot images (and hopefully) 4.x? |
|
@nddipiazza wdyt? lgtm, but 🤷♂️ |
Yes tell me which one |
|
Sorry for my delay. Let's punt on the tika-docker repo and just hope to move everything to the base tika repo asap. One issue that came up in review with an agent is whether we want reproducible builds. I think we do. If that's the case, then we should modify image.created to point to the commit date NOT the build time. @nddipiazza and @Erwan-loot wdyt? I know we want reproducible builds for the base artifacts. We may as well aim for them in Docker images? I don't know enough about this to be useful in decision making and I look forward to feedback. |
Pin org.opencontainers.image.created to the commit timestamp (git show -s --format=%cI HEAD) instead of the build-time clock, so identical sources produce identical labels. Aligns with the SOURCE_DATE_EPOCH convention and keeps created consistent with the revision label, which already points at the source commit. Signed-off-by: Erwan Hervé <erwan@herve.tech>
|
Done — pushed a commit that pins
|
|
Thank you @Erwan-loot! @nddipiazza and fellow devs if you have any recommendations, let's open a separate ticket/issue. |
Context
Add OCI Image Spec standard labels to all five Dockerfiles published by this repository, and wire the dynamic labels through the two CI workflows.
This PR touches Docker metadata only — no changes to Tika source code, Maven build, tests, or runtime behaviour.
Note: JIRA registration is currently closed, so I was unable to file a tracker issue first. If a JIRA ticket is required, I'm happy to create one once registration reopens, or a maintainer can create it and I'll update the PR title accordingly.
Type
Improvement — Docker metadata only, no functional changes.
Dockerfiles modified
tika-server/docker-build/minimal/Dockerfileapache/tika:X.Y.Ztika-server/docker-build/full/Dockerfileapache/tika:X.Y.Z-fulltika-server/docker-build/minimal/Dockerfile.snapshotapache/tika:X.Y.Z-SNAPSHOTtika-server/docker-build/full/Dockerfile.snapshotapache/tika:X.Y.Z-SNAPSHOT-fulltika-grpc/docker-build/Dockerfileapache/tika-grpc:X.Y.ZLabels added
org.opencontainers.image.title"Apache Tika Server"/"Apache Tika Server (full)"/"Apache Tika gRPC Server"org.opencontainers.image.descriptionorg.opencontainers.image.urlhttps://hub.docker.com/r/apache/tika(or/tika-grpc)org.opencontainers.image.sourcehttps://github.com/apache/tikaorg.opencontainers.image.documentationhttps://tika.apache.org/org.opencontainers.image.vendorApache Software Foundationorg.opencontainers.image.licensesApache-2.0org.opencontainers.image.version${TIKA_VERSION}/${VERSION}org.opencontainers.image.revision${REVISION}— git SHA at build timeorg.opencontainers.image.created${CREATED}— RFC 3339 build timestampThe existing
maintainerlabel is preserved as-is in all files.CI changes
A new
Set build metadatastep is added to each Docker job in both workflows (docker-release.ymlanddocker-snapshot.yml). It capturesgit rev-parse HEAD(the exact checked-out commit, notGITHUB_SHA, so it is correct for theworkflow_dispatch-with-source_refpath) and the current UTC timestamp, then passes them asREVISIONandCREATEDbuild-args to everydocker/build-push-actioncall.If
REVISIONorCREATEDare not supplied (e.g. a localdocker buildwithout the build-args), the ARGs default to empty strings — the labels are still present but unpopulated, which is harmless.Benefits
org.opencontainers.image.sourceto link release notes in update PRsrevision+createdallow pinpointing the exact source commit and build time for security audits and CVE investigationsHow to verify
After the next CI build, inspect the published image:
All
org.opencontainers.image.*keys should be present and populated.References