Skip to content

Commit

Permalink
Extracted common trimmed JRE image to separate container image tigase…
Browse files Browse the repository at this point in the history
…/tigase-xmpp-server-base:17 (jre-17)
  • Loading branch information
hantu85 committed Jan 12, 2024
1 parent cd87ff9 commit 1d92f95
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 43 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ for VERSION in 8.0.0 8.1.0 8.1.1 8.1.2 ; do \
done
```

2) Newer versions with multiple types -- currently only `nightly` version but after releasing more version each subsequent version should be added to the list
2) Newer versions with multiple types -- currently only `nightly` version but after releasing more version each subsequent version should be added to the list.

This image (and its build process) depends on `tigase/tigase-xmpp-server-base:17`, which build process is described in point 4.
```bash
for TYPE in "" "-enterprise" ; do
for VERSION in 8.2.0 8.2.1 8.2.2 8.3.0 nightly ; do
Expand All @@ -282,7 +284,7 @@ for TYPE in "" "-enterprise" ; do
done
```

3) Version that's also `latest`
3) Version that's also `latest`
```bash
for TYPE in "" "-enterprise" ; do
for VERSION in 8.3.0 ; do
Expand All @@ -291,6 +293,11 @@ for TYPE in "" "-enterprise" ; do
done
```

4) Building JRE 17 used by nightly builds
```
docker buildx build --platform linux/amd64,linux/arm64 -t tigase/tigase-xmpp-server-base:17 -f jre-17/Dockerfile --no-cache jre-17 --push
```

## Publishing

> **NOTE**: Below instructions don't apply to multi-arch builds as those push only single architecture image!
Expand Down
55 changes: 55 additions & 0 deletions jre-17/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#FROM eclipse-temurin:17-jre
FROM eclipse-temurin:17 as jre-build

# Create a custom Java runtime / to get the required modules use `jdeps -s jars/<binary>.jar`
RUN $JAVA_HOME/bin/jlink \
# tigase-server
--add-modules java.base \
--add-modules java.logging \
--add-modules java.management \
--add-modules java.management.rmi \
--add-modules java.rmi \
--add-modules java.naming \
--add-modules jdk.naming.rmi \
--add-modules jdk.naming.dns \
--add-modules java.security.sasl \
--add-modules java.sql \
--add-modules jdk.management \
# java.scripting can probably removed after removing groovy
--add-modules java.scripting \
# required for WebSockets
--add-modules java.net.http \
# required for TLS
--add-modules jdk.crypto.ec \
# tigase-http-api
--add-modules java.desktop \
--add-modules jdk.httpserver \
# groovy
--add-modules java.compiler \
--add-modules java.prefs \
--add-modules java.xml \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output ./javaruntime

# Define your base image
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

MAINTAINER "Tigase, Inc." <support@tigase.net>

# Create directory structure, download Tigase XMPP Server -dist-max package and unpack it
# At the same time remove setting JAVA_HOME from etc/tigase.conf as variable is already set
# Then move content of etc/ directory to etc.orig/ to be able to use volume to host configuration.
# Additionally we are removing docs/ and downloaded package to reduce size.

ARG TYPE=""
ENV TYPE ${TYPE}

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl less \
&& rm -rf /var/lib/apt/lists/*
43 changes: 2 additions & 41 deletions nightly/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
#FROM eclipse-temurin:17-jre
FROM eclipse-temurin:17 as jre-build

# Create a custom Java runtime / to get the required modules use `jdeps -s jars/<binary>.jar`
RUN $JAVA_HOME/bin/jlink \
# tigase-server
--add-modules java.base \
--add-modules java.logging \
--add-modules java.management \
--add-modules java.management.rmi \
--add-modules java.rmi \
--add-modules java.naming \
--add-modules jdk.naming.rmi \
--add-modules jdk.naming.dns \
--add-modules java.security.sasl \
--add-modules java.sql \
--add-modules jdk.management \
# java.scripting can probably removed after removing groovy
--add-modules java.scripting \
# required for WebSockets
--add-modules java.net.http \
# required for TLS
--add-modules jdk.crypto.ec \
# tigase-http-api
--add-modules java.desktop \
--add-modules jdk.httpserver \
# groovy
--add-modules java.compiler \
--add-modules java.prefs \
--add-modules java.xml \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output ./javaruntime

# Define your base image
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME
FROM tigase/tigase-xmpp-server-base:17

MAINTAINER "Tigase, Inc." <support@tigase.net>

Expand All @@ -53,7 +14,7 @@ ENV TYPE ${TYPE}
RUN mkdir /home/tigase \
&& cd /home/tigase \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates wget curl less \
&& apt-get install -y --no-install-recommends wget \
&& wget -nv https://build.tigase.net/nightlies/dists/latest/tigase-server-dist${TYPE}.tar.gz \
&& apt-get remove -y wget \
&& rm -rf /var/lib/apt/lists/* \
Expand Down

0 comments on commit 1d92f95

Please sign in to comment.