Initial version of an Openfire container

This commit is contained in:
Knut Ahlers 2018-02-10 14:49:46 +01:00
commit 507393fe49
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 54 additions and 0 deletions

21
Dockerfile Normal file
View file

@ -0,0 +1,21 @@
FROM alpine
LABEL maintainer Knut Ahlers <knut@ahlers.me>
ENV OPENFIRE_VERSION=4_2_1
RUN set -ex \
&& apk --no-cache add curl openjdk8 ca-certificates bash \
&& mkdir /opt \
&& curl -sSfL "https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_${OPENFIRE_VERSION}.tar.gz" | \
tar -xz -C /opt \
&& curl -sSfLo /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 \
&& chmod +x /usr/local/bin/dumb-init
ADD start.sh /usr/local/bin/start.sh
EXPOSE 9090 9091 5222 5223 5269
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/start.sh"]

33
start.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/local/bin/dumb-init /bin/bash
set -euo pipefail
# init configuration
[ -e "/data/security/keystore" ] || {
mkdir -p /data/security
mv /opt/openfire/resources/security/keystore /data/security/keystore
}
[ -d "/data/embedded-db" ] || { mkdir -p /data/embedded-db; }
[ -d "/data/conf" ] || { mv /opt/openfire/conf /data/conf; }
ln -sfn /data/security/keystore /opt/openfire/resources/security/keystore
ln -sfn /data/embedded-db /opt/openfire/embedded-db
rm -rf /opt/openfire/conf && ln -sfn /data/conf /opt/openfire/conf
# start openfire
/opt/openfire/bin/openfire start
# let openfire start
echo "Waiting for Openfire to start..."
count=0
while [ ! -e /opt/openfire/logs/all.log ]; do
if [ $count -eq 60 ]; then
echo "Error starting Openfire. Exiting"
exit 1
fi
count=$(( $count + 1 ))
sleep 1
done
# tail the log
tail -f /opt/openfire/logs/all.log