Compare commits
1 commit
main
...
build-from
Author | SHA1 | Date | |
---|---|---|---|
faf7a8096f |
2 changed files with 33 additions and 25 deletions
28
Dockerfile
28
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,27 +25,21 @@ RUN apt-get update \
|
|||
lua-event \
|
||||
lua-expat \
|
||||
lua-filesystem \
|
||||
lua-unbound \
|
||||
lua-sec \
|
||||
lua-socket \
|
||||
lua-unbound \
|
||||
lua-zlib \
|
||||
lua5.1 \
|
||||
lua5.2 \
|
||||
lua5.3 \
|
||||
lua5.4 \
|
||||
luarocks \
|
||||
make \
|
||||
openssl \
|
||||
prosody \
|
||||
procps \
|
||||
ssl-cert \
|
||||
sudo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN update-alternatives --set lua-interpreter /usr/bin/lua5.4
|
||||
|
||||
# Configure prosody
|
||||
RUN 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,14 +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
|
||||
|
||||
pushd /var/run/prosody
|
||||
exec sudo -Eu prosody -- "$@"
|
||||
PATH=$PROSODY_PATH:$PATH
|
||||
|
||||
sudo -Eu prosody -s /usr/bin/bash -- "$@"
|
||||
|
|
Loading…
Reference in a new issue