Skip to content

Commit 2260a19

Browse files
nddipiazzaclaudeCopilot
authored
TIKA-4703: Add Docker CI pipelines for tika-server and tika-grpc (#2715)
* TIKA-4703: Add Docker CI pipelines for tika-server and tika-grpc Move Docker build infrastructure into the main tika repo so that Docker image releases are tied directly to Tika releases rather than requiring cross-repo coordination with tika-docker/tika-grpc-docker. Snapshot workflow (main branch push): - Builds tika-server minimal and full images from Maven output - Builds tika-grpc image from Maven output - Pushes snapshot tags to Docker Hub (e.g. 4.0.0-SNAPSHOT) Release workflow (version tag push): - Builds tika-server minimal/full from Apache mirror JARs with GPG verification (multi-arch: amd64, arm64, arm/v7, s390x) - Builds tika-grpc from Maven output (multi-arch: amd64, arm64) - Pushes versioned + latest tags to Docker Hub Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * TIKA-4703: Fix Docker builds found during local testing - tika-server snapshot Dockerfiles: use assembly tgz (thin JAR + lib/) instead of the thin JAR alone, matching the 4.x packaging model - tika-grpc: bundle default-tika-config.json so the server starts without requiring a config volume mount - tika-grpc: pass -c, -p, and --plugin-roots as CLI args instead of system properties so TikaGrpcServer actually picks them up - tika-grpc: default port is now 9090 (configurable via TIKA_GRPC_PORT) Tested locally: all three images (minimal, full, grpc) build and start successfully. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * TIKA-4703: Add classpath default config for TikaGrpcServer TikaGrpcServer now falls back to a bundled default-tika-config.json from the classpath when no -c flag is provided, matching normal Java application conventions. The default config is empty (no pre-configured fetchers/emitters) — users configure these at runtime. This removes the need for a separate config file in the Docker image. The entrypoint only passes -c when TIKA_CONFIG env var is explicitly set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * TIKA-4703: Address tika-grpc Dockerfile review feedback - run the grpc image as the shared non-root UID/GID - align the grpc image with Java 21 and an LTS Ubuntu base Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 306c79c commit 2260a19

22 files changed

Lines changed: 1239 additions & 1 deletion

File tree

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: Docker release - tika-server and tika-grpc
19+
20+
on:
21+
push:
22+
tags:
23+
- '[0-9]+.[0-9]+.[0-9]+*'
24+
25+
jobs:
26+
release-tika-server:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 60
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Extract version from tag
34+
id: version
35+
run: |
36+
TAG_NAME="${GITHUB_REF#refs/tags/}"
37+
echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Set up QEMU for multi-arch
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Login to Docker Hub
46+
uses: docker/login-action@v3
47+
with:
48+
username: ${{ secrets.DOCKERHUB_USERNAME }}
49+
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+
- name: Build and push tika-server minimal
52+
uses: docker/build-push-action@v6
53+
with:
54+
file: tika-server/docker-build/minimal/Dockerfile
55+
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x
56+
push: true
57+
build-args: |
58+
TIKA_VERSION=${{ steps.version.outputs.tag }}
59+
tags: |
60+
apache/tika:${{ steps.version.outputs.tag }}
61+
apache/tika:latest
62+
63+
- name: Build and push tika-server full
64+
uses: docker/build-push-action@v6
65+
with:
66+
file: tika-server/docker-build/full/Dockerfile
67+
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x
68+
push: true
69+
build-args: |
70+
TIKA_VERSION=${{ steps.version.outputs.tag }}
71+
tags: |
72+
apache/tika:${{ steps.version.outputs.tag }}-full
73+
apache/tika:latest-full
74+
75+
release-tika-grpc:
76+
runs-on: ubuntu-latest
77+
timeout-minutes: 120
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Extract version from tag
83+
id: version
84+
run: |
85+
TAG_NAME="${GITHUB_REF#refs/tags/}"
86+
echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
87+
88+
- name: Set up JDK 17
89+
uses: actions/setup-java@v4
90+
with:
91+
distribution: 'temurin'
92+
java-version: '17'
93+
cache: 'maven'
94+
95+
- name: Build with Maven (skip tests)
96+
run: mvn clean install -DskipTests -B "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
97+
98+
- name: Set up Docker Buildx
99+
uses: docker/setup-buildx-action@v3
100+
101+
- name: Set up QEMU for multi-arch
102+
uses: docker/setup-qemu-action@v3
103+
104+
- name: Login to Docker Hub
105+
uses: docker/login-action@v3
106+
with:
107+
username: ${{ secrets.DOCKERHUB_USERNAME }}
108+
password: ${{ secrets.DOCKERHUB_TOKEN }}
109+
110+
- name: Prepare tika-grpc Docker build context
111+
run: |
112+
TIKA_VERSION="${{ steps.version.outputs.tag }}"
113+
OUT_DIR=target/tika-grpc-docker
114+
115+
mkdir -p "${OUT_DIR}/libs" "${OUT_DIR}/plugins" "${OUT_DIR}/config" "${OUT_DIR}/bin"
116+
117+
cp "tika-grpc/target/tika-grpc-${TIKA_VERSION}.jar" "${OUT_DIR}/libs/"
118+
119+
# Copy tika-pipes plugin zip files
120+
for dir in tika-pipes/tika-pipes-plugins/*/; do
121+
plugin_name=$(basename "$dir")
122+
zip_file="${dir}target/${plugin_name}-${TIKA_VERSION}.zip"
123+
if [ -f "$zip_file" ]; then
124+
cp "$zip_file" "${OUT_DIR}/plugins/"
125+
fi
126+
done
127+
128+
# Copy parser packages
129+
for parser_package in \
130+
"tika-parsers/tika-parsers-standard/tika-parsers-standard-package" \
131+
"tika-parsers/tika-parsers-extended/tika-parser-scientific-package" \
132+
"tika-parsers/tika-parsers-extended/tika-parser-sqlite3-package" \
133+
"tika-parsers/tika-parsers-ml/tika-parser-nlp-package"; do
134+
package_name=$(basename "$parser_package")
135+
jar_file="${parser_package}/target/${package_name}-${TIKA_VERSION}.jar"
136+
if [ -f "$jar_file" ]; then
137+
cp "$jar_file" "${OUT_DIR}/plugins/"
138+
fi
139+
done
140+
141+
cp "tika-grpc/docker-build/start-tika-grpc.sh" "${OUT_DIR}/bin/"
142+
cp "tika-grpc/docker-build/Dockerfile" "${OUT_DIR}/Dockerfile"
143+
144+
- name: Build and push tika-grpc
145+
uses: docker/build-push-action@v6
146+
with:
147+
context: target/tika-grpc-docker
148+
platforms: linux/amd64,linux/arm64
149+
push: true
150+
build-args: |
151+
VERSION=${{ steps.version.outputs.tag }}
152+
tags: |
153+
apache/tika-grpc:${{ steps.version.outputs.tag }}
154+
apache/tika-grpc:latest
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: Docker snapshot - tika-server and tika-grpc
19+
20+
on:
21+
push:
22+
branches: [ main ]
23+
paths-ignore:
24+
- 'docs/**'
25+
- '*.md'
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 120
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: 'temurin'
39+
java-version: '17'
40+
cache: 'maven'
41+
42+
- name: Extract version from pom
43+
id: version
44+
run: |
45+
TIKA_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
46+
echo "tika_version=${TIKA_VERSION}" >> "$GITHUB_OUTPUT"
47+
48+
- name: Build with Maven (skip tests)
49+
run: mvn clean install -DskipTests -B "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
54+
- name: Set up QEMU for multi-arch
55+
uses: docker/setup-qemu-action@v3
56+
57+
- name: Login to Docker Hub
58+
uses: docker/login-action@v3
59+
with:
60+
username: ${{ secrets.DOCKERHUB_USERNAME }}
61+
password: ${{ secrets.DOCKERHUB_TOKEN }}
62+
63+
# --- tika-server (minimal) ---
64+
- name: Prepare tika-server minimal build context
65+
run: |
66+
TIKA_VERSION="${{ steps.version.outputs.tika_version }}"
67+
OUT_DIR=target/tika-server-minimal-docker
68+
mkdir -p "${OUT_DIR}/tika-server"
69+
tar xzf "tika-server/tika-server-standard/target/tika-server-standard-${TIKA_VERSION}-bin.tgz" -C "${OUT_DIR}/tika-server"
70+
cp "tika-server/docker-build/minimal/Dockerfile.snapshot" "${OUT_DIR}/Dockerfile"
71+
72+
- name: Build and push tika-server minimal snapshot
73+
uses: docker/build-push-action@v6
74+
with:
75+
context: target/tika-server-minimal-docker
76+
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x
77+
push: true
78+
build-args: |
79+
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
80+
tags: |
81+
apache/tika:${{ steps.version.outputs.tika_version }}
82+
83+
# --- tika-server (full) ---
84+
- name: Prepare tika-server full build context
85+
run: |
86+
TIKA_VERSION="${{ steps.version.outputs.tika_version }}"
87+
OUT_DIR=target/tika-server-full-docker
88+
mkdir -p "${OUT_DIR}/tika-server"
89+
tar xzf "tika-server/tika-server-standard/target/tika-server-standard-${TIKA_VERSION}-bin.tgz" -C "${OUT_DIR}/tika-server"
90+
cp "tika-server/docker-build/full/Dockerfile.snapshot" "${OUT_DIR}/Dockerfile"
91+
92+
- name: Build and push tika-server full snapshot
93+
uses: docker/build-push-action@v6
94+
with:
95+
context: target/tika-server-full-docker
96+
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x
97+
push: true
98+
build-args: |
99+
TIKA_VERSION=${{ steps.version.outputs.tika_version }}
100+
tags: |
101+
apache/tika:${{ steps.version.outputs.tika_version }}-full
102+
103+
# --- tika-grpc ---
104+
- name: Prepare tika-grpc Docker build context
105+
run: |
106+
TIKA_VERSION="${{ steps.version.outputs.tika_version }}"
107+
OUT_DIR=target/tika-grpc-docker
108+
109+
mkdir -p "${OUT_DIR}/libs" "${OUT_DIR}/plugins" "${OUT_DIR}/config" "${OUT_DIR}/bin"
110+
111+
cp "tika-grpc/target/tika-grpc-${TIKA_VERSION}.jar" "${OUT_DIR}/libs/"
112+
113+
# Copy tika-pipes plugin zip files
114+
for dir in tika-pipes/tika-pipes-plugins/*/; do
115+
plugin_name=$(basename "$dir")
116+
zip_file="${dir}target/${plugin_name}-${TIKA_VERSION}.zip"
117+
if [ -f "$zip_file" ]; then
118+
cp "$zip_file" "${OUT_DIR}/plugins/"
119+
fi
120+
done
121+
122+
# Copy parser packages
123+
for parser_package in \
124+
"tika-parsers/tika-parsers-standard/tika-parsers-standard-package" \
125+
"tika-parsers/tika-parsers-extended/tika-parser-scientific-package" \
126+
"tika-parsers/tika-parsers-extended/tika-parser-sqlite3-package" \
127+
"tika-parsers/tika-parsers-ml/tika-parser-nlp-package"; do
128+
package_name=$(basename "$parser_package")
129+
jar_file="${parser_package}/target/${package_name}-${TIKA_VERSION}.jar"
130+
if [ -f "$jar_file" ]; then
131+
cp "$jar_file" "${OUT_DIR}/plugins/"
132+
fi
133+
done
134+
135+
cp "tika-grpc/docker-build/start-tika-grpc.sh" "${OUT_DIR}/bin/"
136+
cp "tika-grpc/docker-build/Dockerfile" "${OUT_DIR}/Dockerfile"
137+
138+
- name: Build and push tika-grpc snapshot
139+
uses: docker/build-push-action@v6
140+
with:
141+
context: target/tika-grpc-docker
142+
platforms: linux/amd64,linux/arm64
143+
push: true
144+
build-args: |
145+
VERSION=${{ steps.version.outputs.tika_version }}
146+
tags: |
147+
apache/tika-grpc:${{ steps.version.outputs.tika_version }}

tika-grpc/docker-build/Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
# use this file except in compliance with the License. You may obtain a copy of
3+
# the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations under
11+
# the License.
12+
13+
# "random" uid/gid hopefully not used anywhere else
14+
# This needs to be set globally and then referenced in
15+
# the subsequent stages -- see TIKA-3912
16+
ARG UID_GID="35002:35002"
17+
18+
FROM ubuntu:noble
19+
20+
ARG UID_GID
21+
COPY libs/ /tika/libs/
22+
COPY plugins/ /tika/plugins/
23+
COPY config/ /tika/config/
24+
COPY bin/ /tika/bin
25+
ARG JRE='openjdk-21-jre-headless'
26+
ARG VERSION
27+
ARG TIKA_GRPC_MAX_INBOUND_MESSAGE_SIZE=104857600
28+
ARG TIKA_GRPC_MAX_OUTBOUND_MESSAGE_SIZE=104857600
29+
ARG TIKA_GRPC_NUM_THREADS=4
30+
RUN set -eux \
31+
&& apt-get update \
32+
&& apt-get install --yes --no-install-recommends gnupg2 software-properties-common \
33+
&& DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends $JRE \
34+
gdal-bin \
35+
tesseract-ocr \
36+
tesseract-ocr-eng \
37+
tesseract-ocr-ita \
38+
tesseract-ocr-fra \
39+
tesseract-ocr-spa \
40+
tesseract-ocr-deu \
41+
&& echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
42+
&& DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
43+
xfonts-utils \
44+
fonts-freefont-ttf \
45+
fonts-liberation \
46+
ttf-mscorefonts-installer \
47+
wget \
48+
cabextract \
49+
&& apt-get clean -y \
50+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
51+
52+
USER $UID_GID
53+
54+
EXPOSE 9090
55+
ENV TIKA_VERSION=$VERSION
56+
ENV TIKA_GRPC_MAX_INBOUND_MESSAGE_SIZE=$TIKA_GRPC_MAX_INBOUND_MESSAGE_SIZE
57+
ENV TIKA_GRPC_MAX_OUTBOUND_MESSAGE_SIZE=$TIKA_GRPC_MAX_OUTBOUND_MESSAGE_SIZE
58+
ENV TIKA_GRPC_NUM_THREADS=$TIKA_GRPC_NUM_THREADS
59+
RUN chmod +x "/tika/bin/start-tika-grpc.sh"
60+
ENTRYPOINT ["/tika/bin/start-tika-grpc.sh"]
61+
62+
LABEL maintainer="Apache Tika Developers dev@tika.apache.org"

0 commit comments

Comments
 (0)