Dockerfile for ejabberd

31 || 0  || 2018-04-14 06:06:20 || root || || Dockerfile

Dockerfile for building image for ejabberd server on Raspberry Pi

Check the following document with instructions how to build an image and run a container: https://snippets.yoctocloud.cc/snippets/f4ee2da14ecc46db87cb43336a4d4114/

# Version 18.03.0
FROM resin/rpi-raspbian:stretch

# Update OS
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install required packages
RUN apt-get update \
    && apt-get install wget libexpat1 libyaml-0-2 erlang-p1-yaml -y --no-install-recommends \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Set environment variables
ENV EJABBERD_VERSION="18.03"

# Install Ejabberd
RUN wget https://www.process-one.net/downloads/ejabberd/$EJABBERD_VERSION/ejabberd-$EJABBERD_VERSION-linux-armhf-installer.run -O /home/ejabberd.run \
    && chmod +x /home/ejabberd.run \
    && cd /home/ \
    && ./ejabberd.run \
    && rm -rf /home/ejabberd.run \
    && ln -s /home/ejabberd-$EJABBERD_VERSION /home/ejabberd

# Replace node name in ejabberdctl file
RUN sed -i '/ERLANG_NODE=/c\ERLANG_NODE=ejabberd@ejabberd_node' /home/ejabberd/bin/ejabberdctl

# Copy Ejabberd configs
COPY ejabberd.yml /home/ejabberd/conf/ejabberd.yml

# Temporary fix for libtinfo and libncursesw libraries
RUN ln -s /lib/arm-linux-gnueabihf/libtinfo.so.5.9 /lib/arm-linux-gnueabihf/libtinfo.so.6 \
    && ln -s /lib/arm-linux-gnueabihf/libncursesw.so.5.9 /lib/arm-linux-gnueabihf/libncursesw.so.6 \
    && rm -rf /home/ejabberd-18.03/lib/linux-armhf/libncursesw.so.6 \
    && ln -s /lib/arm-linux-gnueabihf/libncursesw.so.5.9 /home/ejabberd-18.03/lib/linux-armhf/libncursesw.so.6

ENTRYPOINT []

# Ejabberd ports
EXPOSE 5222 5280 5443

# Run Ejabberd
CMD ["/home/ejabberd/bin/ejabberdctl", "foreground", "--config-dir", "/home/ejabberd/conf", "--config", "/home/ejabberd/conf/ejabberd.yml", "--ctl-config", "/home/ejabberd/conf/ejabberdctl.cfg", "--logs", "/home/ejabberd/logs", "--spool", "/home/ejabberd/database/ejabberd@ejabberd_node", "--node", "ejabberd@ejabberd_node"]