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