WIP: Build prosody from source instead of using package
This commit is contained in:
parent
6d075b770b
commit
faf7a8096f
2 changed files with 34 additions and 21 deletions
26
Dockerfile
26
Dockerfile
|
@ -6,22 +6,18 @@ FROM debian:12
|
|||
|
||||
MAINTAINER Prosody Developers <developers@prosody.im>
|
||||
|
||||
# Add prosody repository
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
ca-certificates \
|
||||
ssl-cert \
|
||||
&& curl -Lo /etc/apt/sources.list.d/prosody.sources https://prosody.im/files/prosody.sources
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
lsb-base \
|
||||
procps \
|
||||
adduser \
|
||||
ca-certificates \
|
||||
curl \
|
||||
libidn12 \
|
||||
libicu72 \
|
||||
libicu-dev \
|
||||
libssl3 \
|
||||
libssl-dev \
|
||||
lsb-base \
|
||||
lua-bitop \
|
||||
lua-dbi-mysql \
|
||||
lua-dbi-postgresql \
|
||||
|
@ -29,6 +25,7 @@ RUN apt-get update \
|
|||
lua-event \
|
||||
lua-expat \
|
||||
lua-filesystem \
|
||||
lua-unbound \
|
||||
lua-sec \
|
||||
lua-socket \
|
||||
lua-zlib \
|
||||
|
@ -36,16 +33,13 @@ RUN apt-get update \
|
|||
lua5.2 \
|
||||
lua5.3 \
|
||||
lua5.4 \
|
||||
make \
|
||||
openssl \
|
||||
prosody \
|
||||
procps \
|
||||
ssl-cert \
|
||||
sudo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Configure prosody
|
||||
RUN sed -i '1s/^/daemonize = false;\n/' /etc/prosody/prosody.cfg.lua \
|
||||
&& perl -i -pe 'BEGIN{undef $/;} s/^log = {.*?^}$/log = {\n {levels = {min = "info"}, to = "console"};\n}/smg' /etc/prosody/prosody.cfg.lua
|
||||
|
||||
RUN mkdir -p /var/run/prosody && chown prosody:prosody /var/run/prosody
|
||||
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
RUN chmod 755 /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
#!/bin/bash -e
|
||||
set -e
|
||||
|
||||
ACTUAL_PROSODY_VERSION=${PROSODY_VERSION:-0.12.4}
|
||||
PROSODY_PATH="/opt/prosody-$ACTUAL_PROSODY_VERSION"
|
||||
|
||||
mkdir -p /var/run/prosody && chown prosody:prosody /var/run/prosody
|
||||
|
||||
if [ ! -d $PROSODY_PATH ]; then
|
||||
curl -Lo- https://prosody.im/downloads/source/prosody-$ACTUAL_PROSODY_VERSION.tar.gz \
|
||||
| tar -C /opt -xvf-
|
||||
pushd $PROSODY_PATH
|
||||
make
|
||||
make install
|
||||
popd
|
||||
cp $PROSODY_PATH/prosody.cfg.lua.dist /etc/prosody/prosody.cfg.lua
|
||||
sed -i '1s/^/daemonize = false;\n/' /etc/prosody/prosody.cfg.lua
|
||||
perl -i -pe 'BEGIN{undef $/;} s/^log = {.*?^}$/log = {\n {levels = {min = "info"}, to = "console"};\n}/smg' /etc/prosody/prosody.cfg.lua
|
||||
fi
|
||||
|
||||
data_dir_owner="$(stat -c %u "/var/lib/prosody/")"
|
||||
if [[ "$(id -u prosody)" != "$data_dir_owner" ]]; then
|
||||
usermod -u "$data_dir_owner" prosody
|
||||
|
@ -9,13 +26,15 @@ if [[ "$(stat -c %u /var/run/prosody/)" != "$data_dir_owner" ]]; then
|
|||
chown "$data_dir_owner" /var/run/prosody/
|
||||
fi
|
||||
|
||||
if [[ "$1" != "prosody" ]]; then
|
||||
exec prosodyctl "$@"
|
||||
exit 0;
|
||||
fi
|
||||
#if [[ "$1" != "prosody" ]]; then
|
||||
# exec prosodyctl "$@"
|
||||
# exit 0;
|
||||
#fi
|
||||
|
||||
if [[ "$LOCAL" && "$PASSWORD" && "$DOMAIN" ]]; then
|
||||
prosodyctl register "$LOCAL" "$DOMAIN" "$PASSWORD"
|
||||
fi
|
||||
|
||||
exec setpriv --reuid=prosody --regid=prosody --init-groups "$@"
|
||||
PATH=$PROSODY_PATH:$PATH
|
||||
|
||||
sudo -Eu prosody -s /usr/bin/bash -- "$@"
|
||||
|
|
Loading…
Reference in a new issue