-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile_apache_tika
More file actions
35 lines (29 loc) · 1.23 KB
/
Dockerfile_apache_tika
File metadata and controls
35 lines (29 loc) · 1.23 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
# Multi-stage build to reduce final image size
# Stage 1: Download Apache Tika JAR
# Override TIKA_VERSION at build time: docker build --build-arg TIKA_VERSION=x.y.z
ARG TIKA_VERSION=3.3.0
FROM docker.io/debian:bookworm-slim AS downloader
ARG TIKA_VERSION
RUN apt-get update -y && \
apt-get -y install --no-install-recommends ca-certificates curl && \
curl -fSL -o /tika-server.jar \
"https://archive.apache.org/dist/tika/${TIKA_VERSION}/tika-server-standard-${TIKA_VERSION}.jar" && \
chmod 755 /tika-server.jar && \
apt-get remove -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Stage 2: Runtime image with only necessary dependencies
FROM docker.io/debian:bookworm-slim
# Create user and install only runtime dependencies
RUN useradd --system --no-create-home --shell /usr/sbin/nologin gazette && \
apt-get update -y && \
apt-get -y install --no-install-recommends \
default-jre-headless \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy JAR from downloader stage
COPY --from=downloader /tika-server.jar /tika-server.jar
USER gazette
EXPOSE 9998
CMD ["java", "-jar", "/tika-server.jar", "--host", "0.0.0.0"]