-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
150 lines (137 loc) · 4.25 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
FROM debian:bookworm AS builder
ARG SOGO_VERSION
ADD https://packages.sogo.nu/sources/SOGo-${SOGO_VERSION}.tar.gz /tmp/SOGo.tar.gz
ADD https://packages.sogo.nu/sources/SOPE-${SOGO_VERSION}.tar.gz /tmp/SOPE.tar.gz
RUN apt-get update -y && \
apt-get install -y \
git \
zip \
wget \
make \
cmake \
python3 \
python-is-python3 \
gnustep-make \
gnustep-base-common \
gnustep-base-runtime \
libgnustep-base-dev \
gobjc \
libwbxml2-dev \
libxml2-dev \
libxml2-utils \
libssl-dev \
libldap2-dev \
libpq-dev \
libmemcached-dev \
libmariadb-dev-compat \
libytnef0-dev \
zlib1g-dev \
liblasso3-dev \
libcurl4-openssl-dev \
libexpat1-dev \
libpopt-dev \
libsbjson-dev \
libsbjson2.3 \
libcurl4 \
liboath-dev \
libsodium-dev \
libzip-dev && \
rm -rf /var/lib/apt/lists/* && \
mkdir /tmp/SOGo && \
mkdir /tmp/SOPE && \
tar xf /tmp/SOGo.tar.gz -C /tmp/SOGo --strip-components 1 && \
tar xf /tmp/SOPE.tar.gz -C /tmp/SOPE --strip-components 1 && \
cd /tmp/SOPE && \
./configure --with-gnustep --enable-debug --disable-strip && \
make && \
make install && \
cd /tmp/SOGo && \
./configure --enable-debug --disable-strip --enable-saml2 \
--enable-mfa --enable-sodium && \
make && \
make install
FROM debian:bookworm-slim
ARG TARGETARCH
ENV PUID=1000
ENV PGID=1000
# install dependencies
RUN apt-get update -y && \
apt-get install -y \
ca-certificates \
tzdata \
curl \
cron \
gettext \
gnupg2 \
default-mysql-client \
postgresql-client \
apache2 \
supervisor \
gnustep-base-runtime \
libc6 \
libcrypt1 \
libcurl4 \
libgcc-s1 \
libglib2.0-0 \
libgnustep-base1.28 \
libgnutls30 \
liblasso3 \
libldap-2.5-0 \
libmariadb3 \
libmemcached11 \
liboath0 \
libobjc4 \
libpq5 \
libsbjson2.3 \
libsodium23 \
libssl3 \
libwbxml2-1 \
libxml2 \
libytnef0 \
libzip4 \
tmpreaper \
zip \
zlib1g && \
rm -rf /var/lib/apt/lists/* &&\
curl -L -o /usr/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$TARGETARCH
# add config, binaries, libraries, and init files
COPY --from=builder /usr/local/sbin/ /usr/local/sbin/
COPY --from=builder /usr/local/lib/ /usr/local/lib/
COPY --from=builder /tmp/SOGo/Scripts/ /usr/share/doc/sogo/
COPY --from=builder /tmp/SOGo/Apache/SOGo.conf /etc/apache2/conf-available/SOGo.conf
COPY scripts/ /opt/
RUN a2enmod \
headers \
proxy \
proxy_http \
rewrite \
remoteip \
ssl && \
echo "/usr/local/lib/sogo" > /etc/ld.so.conf.d/sogo.conf && \
ldconfig && \
groupadd --system sogo && \
useradd --system --gid sogo sogo && \
(ln -s /usr/local/lib/GNUstep/* /usr/lib/GNUstep/ || :) && \
ln -s /usr/local/lib/GNUstep/Libraries/Resources /usr/lib/GNUstep/Libraries/Resources && \
ln -s /usr/local/sbin/sogo-tool /usr/sbin/sogo-tool && \
ln -s /usr/local/sbin/sogo-ealarms-notify /usr/sbin/sogo-ealarms-notify && \
ln -s /usr/local/sbin/sogo-slapd-sockd /usr/sbin/sogo-slapd-sockd && \
ln -s /etc/apache2/conf-available/SOGo.conf /etc/apache2/conf-enabled/SOGo.conf && \
{\
echo RemoteIPHeader X-Real-IP ;\
echo RemoteIPInternalProxy 10.0.0.0/8 ;\
echo RemoteIPInternalProxy 172.16.0.0/12 ;\
echo RemoteIPInternalProxy 192.168.0.0/16 ;\
} > /etc/apache2/conf-available/remoteip.conf && \
a2enconf remoteip && \
mkdir -p /etc/cron.d /etc/default /etc/sogo /etc/logrotate.d && \
mv /usr/share/doc/sogo/sogo.cron /etc/cron.d/sogo && \
mv /usr/share/doc/sogo/sogo-default /etc/default/sogo && \
mv /usr/share/doc/sogo/sogo.conf /etc/sogo/sogo.conf && \
mv /usr/share/doc/sogo/logrotate /etc/logrotate.d/sogo && \
chmod +rx /usr/bin/yq && \
chmod +rx /opt/entrypoint.sh && \
chmod +rx /opt/sogod.sh
# start from config folder
WORKDIR /etc/sogo
ENTRYPOINT ["/opt/entrypoint.sh"]