Skip to content

Commit

Permalink
Release 8.2.4 tigase/_server/tigase-server#20
Browse files Browse the repository at this point in the history
  • Loading branch information
hantu85 committed Feb 8, 2024
1 parent fd44e00 commit af85ab9
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 1 deletion.
84 changes: 84 additions & 0 deletions 8.3.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#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 mkdir /home/tigase \
&& cd /home/tigase \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates wget curl less \
&& wget -nv https://github.com/tigase/tigase-server/releases/download/tigase-server-8.3.1/tigase-server-8.3.1-b12235-dist${TYPE}.tar.gz \
&& apt-get remove -y wget \
&& rm -rf /var/lib/apt/lists/* \
&& tar -zxf tigase-server-8.3.1-b12235-dist${TYPE}.tar.gz \
&& ln -s `find . -name 'tigase-server-*' -maxdepth 1 -type d` tigase-server \
&& rm -rf tigase-server/docs/ \
&& rm -rf tigase-server-*${TYPE}.tar.gz \
&& sed -i -e 's/JAVA_HOME/#JAVA_HOME/' tigase-server/etc/tigase.conf \
&& mv tigase-server/etc tigase-server/etc.orig

# Add statup scripts and make them executable
# We need custom scripts to make sure that database is upgraded
# and that Tigase will NOT be launched as background service!
ADD scripts/start.sh /start.sh
RUN chmod 755 /start.sh

# Set TIGASE_HOME variable
ENV TIGASE_HOME /home/tigase/tigase-server

# Set ports of the container which can be exposed
EXPOSE 5222 5223 5269 5277 5280 5281 5290 5291 8080 9050 9070

# Set possible volume (directories which can be mounted from the docker host machine)
# like etc/, conf/, certs/, logs/, data/
VOLUME ["/home/tigase/tigase-server/etc", "/home/tigase/tigase-server/conf", "/home/tigase/tigase-server/certs", "/home/tigase/tigase-server/logs", "/home/tigase/tigase-server/data", "/home/tigase/tigase-server/tigasedb"]

# Define script which should be executed on container startup
CMD ["/bin/bash", "/start.sh"]
33 changes: 33 additions & 0 deletions 8.3.1/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

if [[ ! -z "$COPY_CONFIG_SRC" ]]; then
echo "Copying config from $COPY_CONFIG_SRC ..."
cp -L -r -n -v "$COPY_CONFIG_SRC/config.tdsl" /home/tigase/tigase-server/etc
echo "--------------------------------------"
fi

cp -r -n /home/tigase/tigase-server/etc.orig/* /home/tigase/tigase-server/etc/

echo "Checking if database is already available: ${DB_HOST}:${DB_PORT}";
if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ] ; then
/home/tigase/tigase-server/scripts/wait-for-it.sh "${DB_HOST}":"${DB_PORT}" -t 30
fi
if grep -q "config-type.*setup" "/home/tigase/tigase-server/etc/config.tdsl" ; then
echo "Running in setup mode, skipping schema upgrade...";
else
echo "Upgrading database schema...";
ADDITIONAL_PARAMS=""
if [[ ! -z "$ADMIN_JID" && ! -z "$ADMIN_PASSWORD" ]]; then
ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --adminJID=\"$ADMIN_JID\" --adminJIDpass=\"$ADMIN_PASSWORD\"";
fi
if [[ ! -z "$DB_ROOT_USER" && ! -z "$DB_ROOT_PASS" ]]; then
ADDITIONAL_PARAMS="-R \"${DB_ROOT_USER}\" -A \"${DB_ROOT_PASS}\"";
fi
if [[ ! -z "$DB_LOG_LEVEL" ]]; then
ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS -L \"${DB_LOG_LEVEL}\"";
fi
/home/tigase/tigase-server/scripts/tigase.sh upgrade-schema /home/tigase/tigase-server/etc/tigase.conf "$ADDITIONAL_PARAMS"
fi

echo "Starting Tigase XMPP Server...";
/home/tigase/tigase-server/scripts/tigase.sh run /home/tigase/tigase-server/etc/tigase.conf
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Tigase's Docker package for the Tigase XMPP Server.
## Simple tags
- [`nightly` (*nightly/Dockerfile*)](nightly/Dockerfile)
- [`nightly-enterprise` (*nightly/Dockerfile*)](nightly/Dockerfile)
- [`8.3.1`, `latest` (*8.3.1/Dockerfile*)](8.2.1/Dockerfile)
- [`8.3.1-enterprise`, `latest-enterprise` (*8.3.1/Dockerfile*)](8.2.1/Dockerfile)
- [`8.3.0`, `latest` (*8.3.0/Dockerfile*)](8.2.1/Dockerfile)
- [`8.3.0-enterprise`, `latest-enterprise` (*8.3.0/Dockerfile*)](8.2.1/Dockerfile)
- [`8.2.1`, `latest` (*8.2.1/Dockerfile*)](8.2.1/Dockerfile)
- [`8.2.1-enterprise`, `latest-enterprise` (*8.2.1/Dockerfile*)](8.2.1/Dockerfile)
- [`8.2.0` (*8.2.0/Dockerfile*)](8.2.0/Dockerfile)
Expand Down Expand Up @@ -278,7 +282,7 @@ done
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
for VERSION in 8.2.0 8.2.1 8.2.2 8.2.3 8.2.4 8.3.0 8.3.1 nightly ; do
docker buildx build --platform linux/amd64,linux/arm64 --build-arg TYPE=${TYPE} -t tigase/tigase-xmpp-server:${VERSION}${TYPE} -f ${VERSION}/Dockerfile --no-cache ${VERSION}/ --push
done
done
Expand Down

0 comments on commit af85ab9

Please sign in to comment.