diff --git a/8.2.2/Dockerfile b/8.2.2/Dockerfile new file mode 100644 index 0000000..65de2cb --- /dev/null +++ b/8.2.2/Dockerfile @@ -0,0 +1,42 @@ +FROM openjdk:11-jre-slim +MAINTAINER "Tigase, Inc." + +# 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 wget curl \ + && wget -nv https://github.com/tigase/tigase-server/releases/download/tigase-server-8.2.2/tigase-server-8.2.2-b11697-dist${TYPE}.tar.gz \ + && apt-get remove -y wget \ + && rm -rf /var/lib/apt/lists/* \ + && tar -zxf tigase-server-8.2.2-b11697-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-8.2.2-b11697-dist${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"] + +# Define script which should be executed on container startup +CMD ["/bin/bash", "/start.sh"] diff --git a/8.2.2/scripts/start.sh b/8.2.2/scripts/start.sh new file mode 100644 index 0000000..8ae3f0c --- /dev/null +++ b/8.2.2/scripts/start.sh @@ -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="$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 diff --git a/README.md b/README.md index 675b7bb..08b9f99 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ 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 ```bash for TYPE in "" "-enterprise" ; do - for VERSION in 8.2.0 8.2.1 8.3.0 nightly ; do + for VERSION in 8.2.0 8.2.1 8.2.2 8.3.0 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