From 352ade3dfb4890c40f17ebff2cfc55c21e8de20e Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 1 Apr 2015 22:14:13 +0200 Subject: [Docker] Add docker support for merge nodes. Also, run as a separate user in docker-dev. --- packaging/docker/catlfish-dev/Dockerfile | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'packaging/docker/catlfish-dev/Dockerfile') diff --git a/packaging/docker/catlfish-dev/Dockerfile b/packaging/docker/catlfish-dev/Dockerfile index b1192cf..11ebed5 100644 --- a/packaging/docker/catlfish-dev/Dockerfile +++ b/packaging/docker/catlfish-dev/Dockerfile @@ -1,9 +1,13 @@ # Catlfish expects to find its configuration in # /usr/local/etc/catlfish/catlfish.config so mounting # /usr/local/etc/catlfish is recommended. This can be done using the -# `-v' flag to `docker run'. Example: +# `-v' flag to `docker run'. -# $ docker run -v /etc/catlfish:/usr/local/etc/catlfish catlfish +# NOTE: The directory on the host system that's mounted at +# /var/local/db/catlfish in the container has to be writable by a host +# user with uid 147. + +# $ docker run -v /etc/catlfish:/usr/local/etc/catlfish:ro catlfish FROM erlang RUN apt-get update @@ -35,25 +39,27 @@ RUN git clone https://git.nordu.net/plop.git RUN make -C plop RUN git clone https://git.nordu.net/catlfish.git -RUN make -C catlfish all -RUN make -C catlfish PREFIX=/usr/local release +RUN make -C catlfish PREFIX=/usr/local all release # Config dir and database dir are mounted from host using `-v' to # 'docker run'. -VOLUME /usr/local/catlfish +VOLUME /usr/local/etc/catlfish VOLUME /var/local/db/catlfish -# Working directory is where catlfish.config is. We want to run in +# Create a catlfish user. +RUN groupadd --gid 147 catlfish +RUN useradd --uid 147 --gid 147 catlfish + +# Working has to be where catlfish.config is. We want to run in # /var/run/catlfish and not in /usr/local/etc/catlfish, so symlink. -RUN mkdir -p /var/run/catlfish/erlang_log /var/run/catlfish/sasl_log -RUN chgrp -R daemon /var/run/catlfish -RUN chmod -R 775 /var/run/catlfish -RUN ln -s /usr/local/etc/catlfish/catlfish.config /var/run/catlfish/ +RUN mkdir /var/run/catlfish WORKDIR /var/run/catlfish - -# Don't run as root. -USER daemon +RUN mkdir erlang_log sasl_log supervisord_log +RUN chown -R catlfish:catlfish /var/run/catlfish +RUN ln -s /usr/local/etc/catlfish/catlfish.config /var/run/catlfish/ # Run supervisord. ADD supervisord.conf /etc/supervisor/ +WORKDIR /var/run/catlfish +USER catlfish CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] -- cgit v1.1