+# Dockerfile for Citadel
+
FROM bitnami/minideb:latest
VOLUME /citadel-data
# Install prerequisites
RUN install_packages make build-essential zlib1g-dev libldap2-dev libssl-dev gettext libical-dev libexpat1-dev curl libcurl4-openssl-dev git autoconf automake netbase libreadline-dev
-# Download and build Citadel
-WORKDIR /tmp/ctdl_build
-RUN sh -c 'git clone git://git.citadel.org/appl/gitroot/citadel.git'
-RUN sh -c 'cd /tmp/ctdl_build/citadel/libcitadel && ./bootstrap && ./configure --prefix=/usr && make && make install'
-RUN sh -c 'cd /tmp/ctdl_build/citadel/citadel && ./bootstrap && ./configure && make && make install'
-RUN sh -c 'cd /tmp/ctdl_build/citadel/webcit && ./bootstrap && ./configure && make && make install'
-RUN sh -c 'cd /tmp/ctdl_build/citadel/textclient && ./bootstrap && ./configure --prefix=/usr && make && make install'
-RUN sh -c 'cd /tmp && rm -vfr /tmp/ctdl_build'
-RUN sh -c 'rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
+# Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
+ADD ctdlvisor.c /tmp
-# ctdlvisor is a supervisor process that handles all of the components
-ADD ctdlvisor.c /tmp/ctdl_build
-RUN sh -c 'cd /tmp/ctdl_build && cc ctdlvisor.c -o /usr/local/bin/ctdlvisor'
+# Download and build Citadel
+RUN sh -c 'mkdir /tmp/ctdl_build && \
+ cd /tmp/ctdl_build && \
+ git clone git://git.citadel.org/appl/gitroot/citadel.git && \
+ cd /tmp/ctdl_build/citadel/libcitadel && \
+ ./bootstrap && \
+ ./configure --prefix=/usr && \
+ make && \
+ make install && \
+ cd /tmp/ctdl_build/citadel/citadel && \
+ ./bootstrap && \
+ ./configure && \
+ make && \
+ make install && \
+ cd /tmp/ctdl_build/citadel/webcit && \
+ ./bootstrap && \
+ ./configure && \
+ make && \
+ make install && \
+ cd /tmp/ctdl_build/citadel/textclient && \
+ ./bootstrap && \
+ ./configure --prefix=/usr --ctdldir=/citadel_data && \
+ make && make install && \
+ cd /tmp && \
+ cc ctdlvisor.c -o /usr/local/bin/ctdlvisor && \
+ rm -vf /tmp/ctdlvisor.c && \
+ cd /tmp && \
+ rm -vfr /tmp/ctdl_build && \
+ rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
# Ports
EXPOSE 25 80 110 119 143 443 465 504 563 587 993 995 2020 5222
-# We don't need the workdir anymore
-RUN rm -fr /tmp/ctdl_build
-
# Let's go!
ENTRYPOINT ["/usr/local/bin/ctdlvisor"]