Skip to content

Commit 200c9c1

Browse files
authored
Add OCI standard image labels to Docker images (#2846)
* chore: add OCI standard labels to Docker images 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> * ci: derive image.created from commit date for reproducible builds 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> --------- Signed-off-by: Erwan Hervé <62173453+Erwan-loot@users.noreply.github.com> Signed-off-by: Erwan Hervé <erwan@herve.tech>
1 parent 6034506 commit 200c9c1

7 files changed

Lines changed: 101 additions & 6 deletions

File tree

.github/workflows/docker-release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ jobs:
130130
echo "grpc<<EOF"; echo "$grpc"; echo "EOF"
131131
} >> "$GITHUB_OUTPUT"
132132
133+
- name: Set build metadata
134+
id: meta
135+
run: |
136+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
137+
echo "created=$(git show -s --format=%cI HEAD)" >> "$GITHUB_OUTPUT"
138+
133139
- name: Set up Docker Buildx
134140
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
135141

@@ -150,6 +156,8 @@ jobs:
150156
push: true
151157
build-args: |
152158
TIKA_VERSION=${{ env.TAG }}
159+
REVISION=${{ steps.meta.outputs.sha }}
160+
CREATED=${{ steps.meta.outputs.created }}
153161
tags: ${{ steps.tags.outputs.minimal }}
154162

155163
- name: Build and push tika-server full
@@ -160,6 +168,8 @@ jobs:
160168
push: true
161169
build-args: |
162170
TIKA_VERSION=${{ env.TAG }}
171+
REVISION=${{ steps.meta.outputs.sha }}
172+
CREATED=${{ steps.meta.outputs.created }}
163173
tags: ${{ steps.tags.outputs.full }}
164174

165175
# After a successful publish, push a `<tag>-<build_number>` git tag for
@@ -186,6 +196,12 @@ jobs:
186196
with:
187197
ref: ${{ inputs.source_ref || env.TAG }}
188198

199+
- name: Set build metadata
200+
id: meta
201+
run: |
202+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
203+
echo "created=$(git show -s --format=%cI HEAD)" >> "$GITHUB_OUTPUT"
204+
189205
- name: Set up JDK 17
190206
uses: actions/setup-java@v5
191207
with:
@@ -266,6 +282,8 @@ jobs:
266282
push: true
267283
build-args: |
268284
VERSION=${{ env.TAG }}
285+
REVISION=${{ steps.meta.outputs.sha }}
286+
CREATED=${{ steps.meta.outputs.created }}
269287
# apache/tika-grpc is new in 4.x with no prior `:latest` to protect, so
270288
# we track latest from the start (unlike apache/tika the server image,
271289
# whose :latest stays on 3.x until 4.0.0 GA).

.github/workflows/docker-snapshot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ jobs:
7575
TIKA_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
7676
echo "tika_version=${TIKA_VERSION}" >> "$GITHUB_OUTPUT"
7777
78+
- name: Set build metadata
79+
id: meta
80+
run: |
81+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
82+
echo "created=$(git show -s --format=%cI HEAD)" >> "$GITHUB_OUTPUT"
83+
7884
- name: Build with Maven (skip tests)
7985
run: mvn clean install -DskipTests -B "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
8086

@@ -107,6 +113,8 @@ jobs:
107113
load: true
108114
build-args: |
109115
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
116+
REVISION=${{ steps.meta.outputs.sha }}
117+
CREATED=${{ steps.meta.outputs.created }}
110118
tags: tika-server-minimal-smoke:ci
111119

112120
- name: Smoke test tika-server minimal image
@@ -139,6 +147,8 @@ jobs:
139147
push: true
140148
build-args: |
141149
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
150+
REVISION=${{ steps.meta.outputs.sha }}
151+
CREATED=${{ steps.meta.outputs.created }}
142152
tags: |
143153
apache/tika:${{ steps.version.outputs.tika_version }}
144154
@@ -159,6 +169,8 @@ jobs:
159169
load: true
160170
build-args: |
161171
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
172+
REVISION=${{ steps.meta.outputs.sha }}
173+
CREATED=${{ steps.meta.outputs.created }}
162174
tags: tika-server-full-smoke:ci
163175

164176
- name: Smoke test tika-server full image
@@ -191,6 +203,8 @@ jobs:
191203
push: true
192204
build-args: |
193205
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
206+
REVISION=${{ steps.meta.outputs.sha }}
207+
CREATED=${{ steps.meta.outputs.created }}
194208
tags: |
195209
apache/tika:${{ steps.version.outputs.tika_version }}-full
196210
@@ -240,6 +254,8 @@ jobs:
240254
load: true
241255
build-args: |
242256
VERSION=${{ steps.version.outputs.tika_version }}
257+
REVISION=${{ steps.meta.outputs.sha }}
258+
CREATED=${{ steps.meta.outputs.created }}
243259
tags: tika-grpc-smoke:ci
244260

245261
- name: Smoke test tika-grpc image
@@ -274,5 +290,7 @@ jobs:
274290
push: true
275291
build-args: |
276292
VERSION=${{ steps.version.outputs.tika_version }}
293+
REVISION=${{ steps.meta.outputs.sha }}
294+
CREATED=${{ steps.meta.outputs.created }}
277295
tags: |
278296
apache/tika-grpc:${{ steps.version.outputs.tika_version }}

tika-grpc/docker-build/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,16 @@ ENV TIKA_GRPC_MAX_OUTBOUND_MESSAGE_SIZE=$TIKA_GRPC_MAX_OUTBOUND_MESSAGE_SIZE
6161
ENV TIKA_GRPC_NUM_THREADS=$TIKA_GRPC_NUM_THREADS
6262
ENTRYPOINT ["/tika/bin/start-tika-grpc.sh"]
6363

64-
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"
64+
ARG REVISION
65+
ARG CREATED
66+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org" \
67+
org.opencontainers.image.title="Apache Tika gRPC Server" \
68+
org.opencontainers.image.description="Apache Tika content detection and analysis server with gRPC interface" \
69+
org.opencontainers.image.url="https://hub.docker.com/r/apache/tika-grpc" \
70+
org.opencontainers.image.source="https://github.com/apache/tika" \
71+
org.opencontainers.image.documentation="https://tika.apache.org/" \
72+
org.opencontainers.image.vendor="Apache Software Foundation" \
73+
org.opencontainers.image.licenses="Apache-2.0" \
74+
org.opencontainers.image.version="${VERSION}" \
75+
org.opencontainers.image.revision="${REVISION}" \
76+
org.opencontainers.image.created="${CREATED}"

tika-server/docker-build/full/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,16 @@ EXPOSE 9998
8989
# tika-server auto-discovers pf4j plugins from /opt/tika-server/plugins/.
9090
ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp \"/opt/tika-server/*:/opt/tika-server/lib/*:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $0 $@"]
9191

92-
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"
93-
92+
ARG REVISION
93+
ARG CREATED
94+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org" \
95+
org.opencontainers.image.title="Apache Tika Server (full)" \
96+
org.opencontainers.image.description="Apache Tika content detection and analysis server with OCR, fonts, and GDAL support" \
97+
org.opencontainers.image.url="https://hub.docker.com/r/apache/tika" \
98+
org.opencontainers.image.source="https://github.com/apache/tika" \
99+
org.opencontainers.image.documentation="https://tika.apache.org/" \
100+
org.opencontainers.image.vendor="Apache Software Foundation" \
101+
org.opencontainers.image.licenses="Apache-2.0" \
102+
org.opencontainers.image.version="${TIKA_VERSION}" \
103+
org.opencontainers.image.revision="${REVISION}" \
104+
org.opencontainers.image.created="${CREATED}"

tika-server/docker-build/full/Dockerfile.snapshot

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,16 @@ USER $UID_GID
5353
EXPOSE 9998
5454
ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp \"/opt/tika-server/*:/opt/tika-server/lib/*:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $0 $@"]
5555

56-
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"
56+
ARG REVISION
57+
ARG CREATED
58+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org" \
59+
org.opencontainers.image.title="Apache Tika Server (full)" \
60+
org.opencontainers.image.description="Apache Tika content detection and analysis server with OCR, fonts, and GDAL support" \
61+
org.opencontainers.image.url="https://hub.docker.com/r/apache/tika" \
62+
org.opencontainers.image.source="https://github.com/apache/tika" \
63+
org.opencontainers.image.documentation="https://tika.apache.org/" \
64+
org.opencontainers.image.vendor="Apache Software Foundation" \
65+
org.opencontainers.image.licenses="Apache-2.0" \
66+
org.opencontainers.image.version="${TIKA_VERSION}" \
67+
org.opencontainers.image.revision="${REVISION}" \
68+
org.opencontainers.image.created="${CREATED}"

tika-server/docker-build/minimal/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,16 @@ EXPOSE 9998
8181
# tika-server auto-discovers pf4j plugins from /opt/tika-server/plugins/.
8282
ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp \"/opt/tika-server/*:/opt/tika-server/lib/*:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $0 $@"]
8383

84-
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"
84+
ARG REVISION
85+
ARG CREATED
86+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org" \
87+
org.opencontainers.image.title="Apache Tika Server" \
88+
org.opencontainers.image.description="Apache Tika content detection and analysis server - lightweight JRE-only build" \
89+
org.opencontainers.image.url="https://hub.docker.com/r/apache/tika" \
90+
org.opencontainers.image.source="https://github.com/apache/tika" \
91+
org.opencontainers.image.documentation="https://tika.apache.org/" \
92+
org.opencontainers.image.vendor="Apache Software Foundation" \
93+
org.opencontainers.image.licenses="Apache-2.0" \
94+
org.opencontainers.image.version="${TIKA_VERSION}" \
95+
org.opencontainers.image.revision="${REVISION}" \
96+
org.opencontainers.image.created="${CREATED}"

tika-server/docker-build/minimal/Dockerfile.snapshot

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,16 @@ USER $UID_GID
3535
EXPOSE 9998
3636
ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp \"/opt/tika-server/*:/opt/tika-server/lib/*:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $0 $@"]
3737

38-
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"
38+
ARG REVISION
39+
ARG CREATED
40+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org" \
41+
org.opencontainers.image.title="Apache Tika Server" \
42+
org.opencontainers.image.description="Apache Tika content detection and analysis server - lightweight JRE-only build" \
43+
org.opencontainers.image.url="https://hub.docker.com/r/apache/tika" \
44+
org.opencontainers.image.source="https://github.com/apache/tika" \
45+
org.opencontainers.image.documentation="https://tika.apache.org/" \
46+
org.opencontainers.image.vendor="Apache Software Foundation" \
47+
org.opencontainers.image.licenses="Apache-2.0" \
48+
org.opencontainers.image.version="${TIKA_VERSION}" \
49+
org.opencontainers.image.revision="${REVISION}" \
50+
org.opencontainers.image.created="${CREATED}"

0 commit comments

Comments
 (0)