Burn the cache when the upstream repo changes
[citadel-docker.git] / Dockerfile
1 # Dockerfile for Citadel
2
3 # This container is built on MiniDeb, a stripped down version of Debian for use in containers.
4 # Rehosting on another base Linux image is not expected to create compatibility issues.
5 FROM debian:stable-slim
6
7 # All long term persistent data goes here.  Any volume driver may be used.
8 VOLUME /citadel-data
9
10 RUN apt -y update
11
12 # Install prerequisites
13 RUN apt -y install gcc bison make zlib1g-dev libldap2-dev libssl-dev gettext libical-dev libexpat1-dev curl libcurl4-openssl-dev git autoconf automake netbase libreadline-dev
14
15 # Build our own local copy of Berkeley DB, because the one included with the system libs is too old.
16 RUN sh -c 'mkdir /tmp/db_build && \
17         cd /tmp/db_build && \
18         curl -k https://easyinstall.citadel.org/db-6.2.32.NC.tar.gz | tar xvzf - && \
19         cd db-6.2.32.NC/build_unix && \
20         ../dist/configure --prefix=/usr/local/ctdlsupport --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-tcl --disable-test --without-rpm && \
21         make && \
22         make install && \
23         cd /tmp && \
24         rm -fr /tmp/db_build'
25
26 # Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
27 ADD ctdlvisor.c /tmp
28
29 # Burn the cache if the upstream repository has changed
30 ADD "https://code.citadel.org/?p=citadel;a=rss;h=refs/heads/master" /tmp/changes.rss
31
32 # Download and build Citadel
33 RUN sh -c 'export CFLAGS=-I/usr/local/ctdlsupport/include && \
34         export LDFLAGS="-L/usr/local/ctdlsupport/lib -Wl,--rpath -Wl,/usr/local/ctdlsupport/lib" && \
35         mkdir /tmp/ctdl_build && \
36         cd /tmp/ctdl_build && \
37         git clone git://git.citadel.org/citadel && \
38         cd /tmp/ctdl_build/citadel/libcitadel && \
39         ./bootstrap && \
40         ./configure --prefix=/usr && \
41         make && \
42         make install && \
43         cd /tmp/ctdl_build/citadel/citadel && \
44         ./bootstrap && \
45         ./configure && \
46         make && \
47         make install && \
48         cd /tmp/ctdl_build/citadel/webcit && \
49         ./bootstrap && \
50         ./configure && \
51         make && \
52         make install && \
53         cd /tmp/ctdl_build/citadel/textclient && \
54         ./bootstrap && \
55         ./configure --prefix=/usr --ctdldir=/citadel_data && \
56         make && make install && \
57         cd /tmp && \
58         cc ctdlvisor.c -o /usr/local/bin/ctdlvisor && \
59         rm -vf /tmp/ctdlvisor.c && \
60         cd /tmp && \
61         rm -vfr /tmp/ctdl_build && \
62         rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
63
64 # Ports
65 EXPOSE 25 80 110 119 143 443 465 504 563 587 993 995 2020 5222
66
67 # Let's go!
68 ENTRYPOINT ["/usr/local/bin/ctdlvisor"]