-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 8.2.4 tigase/_server/tigase-server#20
- Loading branch information
Showing
3 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters