1 # Dockerfile for Citadel
3 # Debian Slim has all of the architectures we build on (amd64, i386, arm32)
4 # The first stage build will bring in all of our development tools.
5 FROM debian:bullseye-slim AS build-stage
7 # The "branch" argument specifies the branch or tag from which we will build.
10 # All long term persistent data goes here. Any volume driver may be used.
13 # Install prerequisites
15 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
17 # Build our own local copy of Berkeley DB, because the one included with the system libs is too old.
18 # For the container ... we're going to do static binaries because disk is cheap and the Gotards are doing it this way now too.
19 RUN sh -c 'mkdir /tmp/db_build && \
21 curl -k https://easyinstall.citadel.org/db-6.2.32.NC.tar.gz | tar xvzf - && \
22 cd db-6.2.32.NC/build_unix && \
23 ../dist/configure --prefix=/usr/local --disable-static --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-tcl --disable-test --without-rpm && \
29 # Create our build directory
30 RUN mkdir /tmp/ctdl_build
32 # Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
36 cc ctdlvisor.c -o /usr/local/bin/ctdlvisor && \
37 rm -vf /tmp/ctdlvisor.c'
39 # Grab the repository at the specified branch or tag. If there wasn't any change we should enjoy the cache.
41 cd /tmp/ctdl_build && \
42 git clone -b $branch --single-branch git://git.citadel.org/citadel'
46 cd /tmp/ctdl_build/citadel/libcitadel && \
48 ./configure --prefix=/usr/local && \
52 # Build the Citadel Server
54 export CFLAGS=-I/usr/local/include && \
55 export LDFLAGS=-L/usr/local/lib && \
56 cd /tmp/ctdl_build/citadel/citadel && \
62 # Build the WebCit front end
64 export CFLAGS=-I/usr/local/include && \
65 export LDFLAGS=-L/usr/local/lib && \
66 cd /tmp/ctdl_build/citadel/webcit && \
72 # Build the text mode client
74 export CFLAGS=-I/usr/local/include && \
75 export LDFLAGS=-L/usr/local/lib && \
76 cd /tmp/ctdl_build/citadel/textclient && \
77 ./configure --prefix=/usr --ctdldir=/citadel_data && \
78 make && make install && \
80 rm -vfr /tmp/ctdl_build && \
81 rm -vrf /usr/local/citadel/data /usr/local/citadel/files /usr/local/citadel/keys /usr/local/webcit/keys'
83 ####################################################################################################
85 # Second stage build is runtime only.
86 FROM debian:bullseye-slim AS final-stage
88 # All long term persistent data goes here. Any volume driver may be used.
91 # Install prerequisites
93 RUN apt -y install zlib1g libical3 libexpat1 curl libcurl4 netbase libreadline8 libldap-2.4-2 libssl1.1
95 # Bring in Citadel and libraries
96 COPY --from=build-stage /usr/local/ /usr/local/
100 EXPOSE 25 80 110 119 143 443 465 504 563 587 993 995 2020 5222
103 ENTRYPOINT ["/usr/local/bin/ctdlvisor"]