From 6c35f49dd8c0a8f8add13c177660e65c64e649eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 17 Feb 2017 18:25:49 +0100 Subject: Add a biboumi Dockerfile --- docker/biboumi/Dockerfile | 45 ++++++++++++++++++++++++++++++++++++++ docker/biboumi/README.rst | 51 ++++++++++++++++++++++++++++++++++++++++++++ docker/biboumi/biboumi.cfg | 6 ++++++ docker/biboumi/entrypoint.sh | 10 +++++++++ 4 files changed, 112 insertions(+) create mode 100644 docker/biboumi/Dockerfile create mode 100644 docker/biboumi/README.rst create mode 100644 docker/biboumi/biboumi.cfg create mode 100644 docker/biboumi/entrypoint.sh diff --git a/docker/biboumi/Dockerfile b/docker/biboumi/Dockerfile new file mode 100644 index 0000000..95bd150 --- /dev/null +++ b/docker/biboumi/Dockerfile @@ -0,0 +1,45 @@ +# This Dockerfile creates a docker image running biboumi + +FROM docker.io/fedora:latest + +RUN dnf --refresh install -y\ + gcc-c++\ + cmake\ + make\ + udns-devel\ + sqlite-devel\ + libuuid-devel\ + expat-devel\ + libidn-devel\ + systemd-devel\ + git\ + python\ + && dnf clean all + +# Install botan +RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && ldconfig && rm -rf /botan + +# Install litesql +RUN git clone git://git.louiz.org/litesql && mkdir /litesql/build && cd /litesql/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make -j8 && cd /litesql/build && make install && ldconfig && rm -rf /litesql + +# Install biboumi +RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./biboumi/build &&\ + cmake .. -DCMAKE_INSTALL_PREFIX=/usr\ + -DCMAKE_BUILD_TYPE=Release\ + -DWITH_BOTAN=1\ + -DWITH_LITESQL=1\ + -DWITH_LIBIDN=1\ + -DWITH_SYSTEMD=1\ + && make -j8 && make install && rm -rf /biboumi + +RUN useradd biboumi + +COPY ./biboumi.cfg /etc/biboumi/biboumi.cfg +RUN chown -R biboumi:biboumi /etc/biboumi + +COPY ./entrypoint.sh /entrypoint.sh +RUN chmod 755 /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +USER biboumi diff --git a/docker/biboumi/README.rst b/docker/biboumi/README.rst new file mode 100644 index 0000000..b9c63ea --- /dev/null +++ b/docker/biboumi/README.rst @@ -0,0 +1,51 @@ +Biboumi Docker Image +==================== + +Running +------- + +This image does not embed any XMPP server. You need to have a running XMPP +server (as an other docker container for example) first. + +Assuming you have a running `prosody +`_ container already running and +`properly configured +`_ you can +use the following command to start your biboumi container. + +``` +docker run --link prosody:xmpp \ + -e BIBOUMI_PASSWORD=P4SSW0RD \ + -e BIBOUMI_HOSTNAME=irc.example.com \ + -e BIBOUMI_ADMIN=blabla \ + biboumi +``` + +Variables +--------- + +The configuration file inside the image is a template that is completed when +the container is started, using the following environment variables: + +* BIBOUMI_HOSTNAME: Sets the value of the *hostname* option. +* BIBOUMI_SECRET: Sets the value of the *password* option. +* BIBOUMI_ADMIN: Sets the value of the *admin* option. + +All these variables are optional, but biboumi will probably fail to start if +the hostname and secret are missing. + +You can also directly provide your own configuration file by mounting it +inside the container using the -v option: + +``` +docker run --link prosody:xmpp \ + -v $PWD/biboumi.cfg:/etc/biboumi/biboumi.cfg \ + biboumi +``` + +Linking with the XMPP server +---------------------------- + +You can use the --link option to connect to any server, but it needs to be +called *xmpp*. For example, if you are using a container named ejabberd, you +would use the option *--link ejabberd:xmpp*. diff --git a/docker/biboumi/biboumi.cfg b/docker/biboumi/biboumi.cfg new file mode 100644 index 0000000..fff6563 --- /dev/null +++ b/docker/biboumi/biboumi.cfg @@ -0,0 +1,6 @@ +xmpp_server_ip=xmpp +port=5347 +db_name=/var/lib/biboumi/biboumi.sqlite +hostname=BIBOUMI_HOSTNAME +password=BIBOUMI_PASSWORD +admin=BIBOUMI_ADMIN diff --git a/docker/biboumi/entrypoint.sh b/docker/biboumi/entrypoint.sh new file mode 100644 index 0000000..a0c0508 --- /dev/null +++ b/docker/biboumi/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +sed -i s/BIBOUMI_HOSTNAME/${BIBOUMI_HOSTNAME:-biboumi.localhost}/ /etc/biboumi/biboumi.cfg +sed -i s/BIBOUMI_ADMIN/${BIBOUMI_ADMIN:-}/ /etc/biboumi/biboumi.cfg +sed -i s/BIBOUMI_SECRET/${BIBOUMI_SECRET:-missing_secret}/ /etc/biboumi/biboumi.cfg + +echo "Running biboumi with the following conf: " +cat /etc/biboumi/biboumi.cfg + +/usr/bin/biboumi /etc/biboumi/biboumi.cfg -- cgit v1.2.3