Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
200 lines (150 loc) · 6.92 KB
/
Copy pathDockerfile
File metadata and controls
200 lines (150 loc) · 6.92 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
FROM debian:trixie-backports as base
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_LISTCHANGES_FRONTEND=none
RUN apt-get update -qq
RUN apt-get install --no-install-recommends -y dpkg-dev devscripts equivs curl git
RUN echo "deb [signed-by=/etc/apt/trusted.gpg.d/spectrumim.gpg] https://packages.spectrum.im/spectrum2/ trixie main" | tee -a /etc/apt/sources.list
RUN curl https://packages.spectrum.im/packages.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/spectrumim.gpg
RUN apt-get update -qq
# Spectrum 2
COPY . spectrum2/
RUN mk-build-deps --install --remove \
--tool "apt-get -y --no-install-recommends" spectrum2/packaging/debian/debian/control
RUN apt-get install --no-install-recommends -y libminiupnpc-dev libnatpmp-dev
RUN apt-get install --no-install-recommends -y cmake
#TODO include in Build-Depends
RUN apt-get install --no-install-recommends -y libssl-dev
RUN apt-get install --no-install-recommends -y ngircd libcppunit-dev purple-xmpp-carbons libglib2.0-dev psmisc
FROM base as test
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_LISTCHANGES_FRONTEND=none
WORKDIR /spectrum2
RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_SLACK_FRONTEND=ON -DCMAKE_UNITY_BUILD=ON . && make -j4
ENTRYPOINT ["make", "extended_test"]
FROM base as test-clang
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_LISTCHANGES_FRONTEND=none
RUN apt-get update -qq
RUN apt-get install --no-install-recommends -y libcppunit-dev clang-19 lld-19
WORKDIR /spectrum2
RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_SLACK_FRONTEND=ON -DCMAKE_UNITY_BUILD=ON -DCMAKE_C_COMPILER=/usr/bin/clang-19 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-19 -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld . && make -j4
ENTRYPOINT ["make", "test"]
FROM ghcr.io/spectrumim/alpine:1.0.1 as test-musl
COPY . /spectrum2/
WORKDIR /spectrum2
RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_WEBUI=OFF -DENABLE_SLACK_FRONTEND=ON -DCMAKE_UNITY_BUILD=ON . && make -j4
ENTRYPOINT ["make", "test"]
FROM base as staging
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_LISTCHANGES_FRONTEND=none
WORKDIR /spectrum2/packaging/debian/
RUN apt-get install --no-install-recommends -y libjson-glib-dev \
imagemagick librsvg2-bin libsecret-1-dev libnss3-dev \
libwebp-dev libgcrypt20-dev libpng-dev libglib2.0-dev \
libprotobuf-c-dev protobuf-c-compiler libmarkdown2-dev libopusfile-dev \
libqrencode-dev
RUN echo "---> Installing icyque" && \
git clone https://github.com/EionRobb/icyque.git && \
cd icyque && \
git checkout 4d52dbe && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> Install Steam" && \
git clone https://github.com/EionRobb/pidgin-opensteamworks.git && \
cd pidgin-opensteamworks/steam-mobile && \
git checkout 4274774 && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> Install Teams" && \
git clone https://github.com/EionRobb/purple-teams.git && \
cd purple-teams && \
git checkout 62f6fff && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> purple-battlenet" && \
git clone --recursive https://github.com/EionRobb/purple-battlenet && \
cd purple-battlenet && \
git checkout d2113e2 && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> purple-hangouts" && \
git clone --recursive https://github.com/EionRobb/purple-hangouts && \
cd purple-hangouts && \
git checkout 55b9f01 && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> purple-mattermost" && \
git clone --recursive https://github.com/EionRobb/purple-mattermost && \
cd purple-mattermost && \
git checkout 56a7484 && \
make && \
make DESTDIR=/tmp/out install
RUN echo "---> purple-discord" && \
git clone --recursive https://github.com/EionRobb/purple-discord && \
cd purple-discord && \
git checkout 64faf80 && \
make && \
make DESTDIR=/tmp/out install
FROM debian:trixie-slim as production
EXPOSE 8080
VOLUME ["/etc/spectrum2/transports", "/var/lib/spectrum2"]
# purple-gowhatsapp / purple-whatsmeow release build: needs glibc >= 2.34.
# trixie ships a newer glibc, so this is fine (bullseye's 2.31 was NOT enough,
# see below). Upstream deletes old nightly releases, so pin a tagged release;
# bump these three ARGs to move to a newer one.
ARG GOWHATSAPP_RELEASE=v1.26.0
ARG GOWHATSAPP_DEB_AMD64=purple-whatsmeow_1.26.0_amd64.deb
ARG GOWHATSAPP_DEB_ARM64=purple-whatsmeow_1.26.0_arm64.deb
RUN apt-get update -qq
RUN apt-get install --no-install-recommends -y curl ca-certificates gnupg1 gpg gpg-agent
RUN echo "deb [signed-by=/etc/apt/trusted.gpg.d/spectrumim.gpg] https://packages.spectrum.im/spectrum2/ trixie main" | tee -a /etc/apt/sources.list
RUN curl -fsSL https://packages.spectrum.im/packages.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/spectrumim.gpg
RUN apt-get update -qq
ARG TARGETARCH
COPY debs/*.deb /tmp/
RUN echo "---> purple-whatsmeow (gowhatsapp, ${GOWHATSAPP_RELEASE}, ${TARGETARCH})" && \
case "${TARGETARCH}" in \
amd64) GOWHATSAPP_DEB="${GOWHATSAPP_DEB_AMD64}" ;; \
arm64) GOWHATSAPP_DEB="${GOWHATSAPP_DEB_ARM64}" ;; \
*) echo "no purple-whatsmeow build for arch ${TARGETARCH}" >&2; exit 1 ;; \
esac && \
curl -fL -o /tmp/purple-whatsmeow.deb \
"https://github.com/hoehermann/purple-gowhatsapp/releases/download/${GOWHATSAPP_RELEASE}/${GOWHATSAPP_DEB}" && \
apt-get install --no-install-recommends -y /tmp/purple-whatsmeow.deb && \
rm -f /tmp/purple-whatsmeow.deb
# Telegram removed due to it being broken since 2024 anyway (libtdjson1.7.9 /
# libpurple-telegram-tdlib also aren't available for bookworm regardless).
# Runtime libs of the plugins built in the staging stage: json-glib (teams,
# discord, hangouts, icyque, mattermost), protobuf-c (hangouts, battlenet),
# qrencode + nss (discord QR login), libsecret (steam). json-glib used to come
# in only as a dependency of the purple-facebook package.
RUN echo "---> Installing libpurple plugins" && \
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
libjson-glib-1.0-0 \
libprotobuf-c1 \
libqrencode4 libnss3 \
libsecret-1-0 \
libmarkdown2 \
libogg0 libopusfile0 \
frotz \
/tmp/*.deb \
nodejs \
&& rm -rf /var/lib/apt/lists/*
COPY --from=staging /tmp/out/* /usr/
# Fail the build if any libpurple plugin has an unresolved shared library,
# instead of the plugin silently not loading at runtime. tcl.so is libpurple's
# Tcl script loader: Tcl/Tk are only Recommends of libpurple0 and not needed.
RUN echo "---> Checking libpurple plugin dependencies" && \
plugins="$(find /usr/lib -path '*/purple-2/*.so' ! -name tcl.so)" && \
{ echo "$plugins" | grep -q '/libteams\.so$' || \
{ echo "libteams.so not found in any purple-2 plugin dir" >&2; exit 1; }; } && \
missing=0 && \
for so in $plugins; do \
if ldd "$so" | grep -q 'not found'; then \
echo "$so:" >&2; ldd "$so" | grep 'not found' >&2; missing=1; \
fi; \
done && \
[ "$missing" = 0 ]
COPY --from=staging spectrum2/packaging/docker/run.sh /run.sh
RUN rm -rf /tmp/*.deb
ENTRYPOINT ["/run.sh"]