25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00
xmpp.chapril.org-ejabberd/Dockerfile

121 lines
3.8 KiB
Docker
Raw Normal View History

FROM debian:jessie-slim
2016-11-11 00:12:54 +01:00
MAINTAINER Rafael Römhild <rafael@roemhild.de>
2017-08-03 16:55:56 +02:00
ENV EJABBERD_BRANCH=17.08 \
EJABBERD_USER=ejabberd \
EJABBERD_HTTPS=true \
EJABBERD_STARTTLS=true \
EJABBERD_S2S_SSL=true \
2016-11-11 00:12:54 +01:00
EJABBERD_HOME=/opt/ejabberd \
EJABBERD_DEBUG_MODE=false \
HOME=$EJABBERD_HOME \
PATH=$EJABBERD_HOME/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin \
DEBIAN_FRONTEND=noninteractive \
XMPP_DOMAIN=localhost \
# Set default locale for the environment
2016-11-11 00:12:54 +01:00
LC_ALL=C.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8
# Add ejabberd user and group
RUN groupadd -r $EJABBERD_USER \
&& useradd -r -m \
-g $EJABBERD_USER \
-d $EJABBERD_HOME \
$EJABBERD_USER
# Install packages and perform cleanup
RUN set -x \
&& buildDeps=' \
git-core \
build-essential \
automake \
libssl-dev \
zlib1g-dev \
libexpat-dev \
libyaml-dev \
libsqlite3-dev \
erlang-src erlang-dev \
' \
&& requiredAptPackages=' \
wget \
locales \
ldnsutils \
python2.7 \
python-jinja2 \
ca-certificates \
libyaml-0-2 \
erlang-base erlang-snmp erlang-ssl erlang-ssh erlang-webtool \
erlang-tools erlang-xmerl erlang-corba erlang-diameter erlang-eldap \
erlang-eunit erlang-ic erlang-odbc erlang-os-mon \
erlang-parsetools erlang-percept erlang-typer \
python-mysqldb \
imagemagick \
' \
&& apt-key adv \
--keyserver keys.gnupg.net \
--recv-keys 434975BD900CCBE4F7EE1B1ED208507CA14F4FCA \
&& apt-get update \
&& apt-get install -y $buildDeps $requiredAptPackages --no-install-recommends \
&& dpkg-reconfigure locales && \
locale-gen C.UTF-8 \
&& /usr/sbin/update-locale LANG=C.UTF-8 \
&& echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen \
&& locale-gen \
&& cd /tmp \
&& git clone https://github.com/processone/ejabberd.git \
--branch $EJABBERD_BRANCH --single-branch --depth=1 \
&& cd ejabberd \
&& chmod +x ./autogen.sh \
&& ./autogen.sh \
&& ./configure --enable-user=$EJABBERD_USER \
--enable-all \
--disable-tools \
--disable-pam \
&& make debug=$EJABBERD_DEBUG_MODE \
&& make install \
&& mkdir $EJABBERD_HOME/ssl \
&& mkdir $EJABBERD_HOME/conf \
&& mkdir $EJABBERD_HOME/backup \
&& mkdir $EJABBERD_HOME/upload \
&& mkdir $EJABBERD_HOME/database \
&& mkdir $EJABBERD_HOME/module_source \
&& cd $EJABBERD_HOME \
&& rm -rf /tmp/ejabberd \
&& rm -rf /usr/local/etc/ejabberd \
&& ln -sf $EJABBERD_HOME/conf /usr/local/etc/ejabberd \
&& chown -R $EJABBERD_USER: $EJABBERD_HOME \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge -y --auto-remove $buildDeps
RUN wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt; \
update-ca-certificates
# Create logging directories
RUN mkdir -p /var/log/ejabberd
RUN touch /var/log/ejabberd/crash.log /var/log/ejabberd/error.log /var/log/ejabberd/erlang.log
# Wrapper for setting config on disk from environment
# allows setting things like XMPP domain at runtime
ADD ./docker/run.sh /sbin/run
# Add run scripts
ADD ./docker/scripts $EJABBERD_HOME/scripts
ADD https://raw.githubusercontent.com/rankenstein/ejabberd-auth-mysql/master/auth_mysql.py $EJABBERD_HOME/scripts/lib/auth_mysql.py
RUN chmod a+rx $EJABBERD_HOME/scripts/lib/auth_mysql.py
# Add config templates
ADD ./docker/conf /opt/ejabberd/conf
2016-11-11 00:12:54 +01:00
# Continue as user
USER $EJABBERD_USER
2016-11-11 00:12:54 +01:00
# Set workdir to ejabberd root
WORKDIR $EJABBERD_HOME
2016-11-11 00:12:54 +01:00
VOLUME ["$EJABBERD_HOME/database", "$EJABBERD_HOME/ssl", "$EJABBERD_HOME/backup", "$EJABBERD_HOME/upload"]
2016-11-11 00:12:54 +01:00
EXPOSE 4560 5222 5269 5280 5443
CMD ["start"]
ENTRYPOINT ["run"]