summaryrefslogtreecommitdiff
path: root/Prosody/0.12.4/Dockerfile
blob: 9739684c5cea97eab1b569558760047fc83b554d (plain) (blame)
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
FROM alpine
RUN apk update && apk add \
	make \
	gcc \
	g++ \
	git \
	musl-dev \
	linux-headers \
	wget
# Pull dependencies.
COPY --from=lua:5.4.6 /opt/spm/lua-5.4.6/ /usr/local/
COPY --from=libopenssl:3.1.1-minimal /opt/spm/openssl-3.1.1/ /usr/local/
COPY --from=libicu:73.2 /opt/spm/libicu-73.2/ /usr/local/
COPY --from=luastatic /opt/spm/luastatic-master/luastatic /usr/local/bin/
COPY --from=libexpat:2.5.0 /opt/spm/libexpat-2.5.0/ /usr/local/
COPY --from=luaexpat:1.5.0 /opt/spm/luaexpat-1.5.0/ /usr/local/
COPY --from=luafilesystem:1.8.0 /opt/spm/luafilesystem-1.8.0/ /usr/local/
COPY --from=luasocket:3.1.0 /opt/spm/luasocket-3.1.0/ /usr/local/
# Download application.
RUN wget https://prosody.im/downloads/source/prosody-0.12.4.tar.gz
RUN tar -xf prosody-0.12.4.tar.gz
WORKDIR /prosody-0.12.4
# Prosody uses some CLI tools from OpenSSL, and those require access
# to /opt/spm/openssl-3.1.1.
RUN mkdir -p /opt/spm
RUN ln -s /usr/local /opt/spm/openssl-3.1.1
# Prosody shall be installed into a temporary prefix that will be later
# consumed by luastatic to generate the final, statically built executable.
ARG TMP_PREFIX=/tmp/prosody-0.12.4
# Prepare patches.
RUN mkdir patches
COPY 0001-GNUmakefile-Replace-.so-with-.a.patch patches/
RUN git apply patches/0001-GNUmakefile-Replace-.so-with-.a.patch
# Build application.
RUN ./configure \
	--prefix=$TMP_PREFIX \
	--add-cflags='-ffunction-sections -fdata-sections -Os'
RUN make -j$(nproc --all)
RUN make install
# Build application statically.
ARG PREFIX=/opt/spm/prosody-0.12.4/bin
WORKDIR $PREFIX
RUN CC=c++ luastatic \
	$TMP_PREFIX/bin/prosody \
	$(find $TMP_PREFIX/lib -iname '*.lua') \
	$(find $TMP_PREFIX/lib -iname '*.a') \
	$(find /usr/local/lib/lxp -iname '*.lua') \
	$(find /usr/local/lib/socket -iname '*.lua') \
	/usr/local/lib/mime.lua \
	/usr/local/lib/socket.lua \
	/usr/local/lib/lxp.a \
	/usr/local/lib/libexpat.a \
	/usr/local/lib/liblfs.a \
	/usr/local/lib/libluamime.a \
	/usr/local/lib/libluasocket.a \
	/usr/local/lib/liblua.a \
	/usr/local/lib/libicuuc.a \
	/usr/local/lib/libicui18n.a \
	/usr/local/lib/libicudata.a \
	/usr/local/lib64/libcrypto.a  \
	-I/usr/local/include/ \
	-static \
	-Wl,--gc-sections
RUN strip prosody