Build our own local copy of Berkeley DB, because the one included with the system...
[citadel-docker.git] / Dockerfile
1 # Dockerfile for Citadel
2
3 FROM bitnami/minideb:latest
4
5 VOLUME /citadel-data
6
7 # Install prerequisites
8 RUN install_packages gcc make zlib1g-dev libldap2-dev libssl-dev gettext libical-dev libexpat1-dev curl libcurl4-openssl-dev git autoconf automake netbase libreadline-dev
9
10 # Build our own local copy of Berkeley DB, because the one included with the system libs is too old.
11 RUN sh -c 'mkdir /tmp/db_build && \
12         cd /tmp/db_build && \
13         curl -k https://easyinstall.citadel.org/db-6.2.32.NC.tar.gz | tar xvzf - && \
14         cd db-6.2.32.NC/build_unix && \
15         ../dist/configure --prefix=/usr/local/ctdlsupport --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-tcl --disable-test --without-rpm && \
16         make && \
17         make install && \
18         cd /tmp && \
19         rm -fr /tmp/db_build'
20
21 # Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
22 ADD ctdlvisor.c /tmp
23
24 # Download and build Citadel
25 RUN sh -c 'export CFLAGS=-I/usr/local/ctdlsupport/include && \
26         export LDFLAGS="-L/usr/local/ctdlsupport/lib -Wl,--rpath -Wl,/usr/local/ctdlsupport/lib" && \
27         mkdir /tmp/ctdl_build && \
28         cd /tmp/ctdl_build && \
29         git clone git://git.citadel.org/appl/gitroot/citadel.git && \
30         cd /tmp/ctdl_build/citadel/libcitadel && \
31         ./bootstrap && \
32         ./configure --prefix=/usr && \
33         make && \
34         make install && \
35         cd /tmp/ctdl_build/citadel/citadel && \
36         ./bootstrap && \
37         ./configure && \
38         make && \
39         make install && \
40         cd /tmp/ctdl_build/citadel/webcit && \
41         ./bootstrap && \
42         ./configure && \
43         make && \
44         make install && \
45         cd /tmp/ctdl_build/citadel/textclient && \
46         ./bootstrap && \
47         ./configure --prefix=/usr --ctdldir=/citadel_data && \
48         make && make install && \
49         cd /tmp && \
50         cc ctdlvisor.c -o /usr/local/bin/ctdlvisor && \
51         rm -vf /tmp/ctdlvisor.c && \
52         cd /tmp && \
53         rm -vfr /tmp/ctdl_build && \
54         rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
55
56 # Ports
57 EXPOSE 25 80 110 119 143 443 465 504 563 587 993 995 2020 5222
58
59 # Let's go!
60 ENTRYPOINT ["/usr/local/bin/ctdlvisor"]