moved update block and fixed comment
[citadel-docker.git] / Dockerfile
1 # Dockerfile for Citadel
2
3 # Originally we built on MiniDeb, a stripped down version of Debian for use in containers.
4 # Now it's on Debian Slim because we want to build on i386 and arm32.
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 # Install prerequisites
11 RUN apt -y update
12 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
13
14 # Build our own local copy of Berkeley DB, because the one included with the system libs is too old.
15 RUN sh -c 'mkdir /tmp/db_build && \
16         cd /tmp/db_build && \
17         curl -k https://easyinstall.citadel.org/db-6.2.32.NC.tar.gz | tar xvzf - && \
18         cd db-6.2.32.NC/build_unix && \
19         ../dist/configure --prefix=/usr/local/ctdlsupport --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-tcl --disable-test --without-rpm && \
20         make && \
21         make install && \
22         cd /tmp && \
23         rm -fr /tmp/db_build'
24
25 # Create our build directory
26 RUN mkdir /tmp/ctdl_build
27
28 # Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
29 ADD ctdlvisor.c /tmp
30
31 # Burn the cache if the upstream repository has changed
32 ADD "https://easyinstall.citadel.org/libcitadel-easyinstall.tar.gz" /tmp/ctdl_build
33 ADD "https://easyinstall.citadel.org/citadel-easyinstall.tar.gz" /tmp/ctdl_build
34 ADD "https://easyinstall.citadel.org/webcit-easyinstall.tar.gz" /tmp/ctdl_build
35 ADD "https://easyinstall.citadel.org/textclient-easyinstall.tar.gz" /tmp/ctdl_build
36
37 # Download and build Citadel
38 RUN sh -c 'export CFLAGS=-I/usr/local/ctdlsupport/include && \
39         export LDFLAGS="-L/usr/local/ctdlsupport/lib -Wl,--rpath -Wl,/usr/local/ctdlsupport/lib" && \
40         cd /tmp/ctdl_build && \
41         tar xvzf libcitadel-easyinstall.tar.gz && \
42         tar xvzf citadel-easyinstall.tar.gz && \
43         tar xvzf webcit-easyinstall.tar.gz && \
44         tar xvzf textclient-easyinstall.tar.gz && \
45         cd /tmp/ctdl_build/libcitadel && \
46         ./configure --prefix=/usr && \
47         make && \
48         make install && \
49         cd /tmp/ctdl_build/citadel && \
50         ./configure && \
51         make && \
52         make install && \
53         cd /tmp/ctdl_build/webcit && \
54         ./configure && \
55         make && \
56         make install && \
57         cd /tmp/ctdl_build/textclient && \
58         ./bootstrap && \
59         ./configure --prefix=/usr --ctdldir=/citadel_data && \
60         make && make install && \
61         cd /tmp && \
62         cc ctdlvisor.c -o /usr/local/bin/ctdlvisor && \
63         rm -vf /tmp/ctdlvisor.c && \
64         cd /tmp && \
65         rm -vfr /tmp/ctdl_build && \
66         rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
67
68 # Ports
69 EXPOSE 25 80 110 119 143 443 465 504 563 587 993 995 2020 5222
70
71 # Let's go!
72 ENTRYPOINT ["/usr/local/bin/ctdlvisor"]