summaryrefslogtreecommitdiff
path: root/Prosody/0.12.4/Dockerfile
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-20 12:50:34 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-24 22:58:59 +0200
commitf001951e3aec75bf750fda476c0ba4ce443029c3 (patch)
tree3f498ed5b6772043675f1abb5eea084c19fe464d /Prosody/0.12.4/Dockerfile
parent505c7012cb160690afdcf5e50a98970ad346cb1e (diff)
downloadspm-packages-prosody.tar.gz
WIP prosodyprosody
Diffstat (limited to 'Prosody/0.12.4/Dockerfile')
-rw-r--r--Prosody/0.12.4/Dockerfile64
1 files changed, 64 insertions, 0 deletions
diff --git a/Prosody/0.12.4/Dockerfile b/Prosody/0.12.4/Dockerfile
new file mode 100644
index 0000000..9739684
--- /dev/null
+++ b/Prosody/0.12.4/Dockerfile
@@ -0,0 +1,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