Download prosody-modules only once.

This commit is contained in:
Sara Aimée Smiseth 2020-06-27 19:06:27 +02:00
parent 2500028412
commit 9e24592826
5 changed files with 19 additions and 72 deletions

View file

@ -65,8 +65,11 @@ COPY prosody.cfg.lua /usr/local/etc/prosody/prosody.cfg.lua
COPY docker-entrypoint.sh /entrypoint.sh
COPY conf.d/*.cfg.lua /usr/local/etc/prosody/conf.d/
COPY docker-prosody-module-* /usr/local/bin/
RUN docker-prosody-module-install \
COPY *.bash /usr/local/bin/
RUN download-prosody-modules.bash
RUN docker-prosody-module-install.bash \
bookmarks `# XEP-0411: Bookmarks Conversion` \
carbons `# message carbons (XEP-0280)` \
cloud_notify `# XEP-0357: Push Notifications` \
@ -76,10 +79,12 @@ RUN docker-prosody-module-install \
smacks `# stream management (XEP-0198)` \
throttle_presence `# presence throttling in CSI`
RUN docker-prosody-module-copy \
RUN docker-prosody-module-copy.bash \
http_upload `# file sharing (XEP-0363)` \
vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)`
RUN rm -rf "/usr/src/prosody-modules"
USER prosody
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,19 +1,9 @@
#!/bin/sh
#!/bin/bash
set -e
source="/usr/src/prosody-modules"
target="/usr/local/lib/prosody/custom-modules"
srcExists=
if [ -d ${source} ]; then
srcExists=1
fi
docker-prosody-module-source pullTo ${source}
if [ -z "$srcExists" ]; then
touch ${source}/.docker-delete-me
fi
cd ${source}
usage() {
@ -49,7 +39,3 @@ for ext in $exts; do
echo " - copying to ${target}"
cp -r "${source}/mod_${ext}" "${target}/"
done
if [ -e ${source}/.docker-delete-me ]; then
docker-prosody-module-source deleteFrom ${source}
fi

View file

@ -1,20 +1,10 @@
#!/bin/sh
#!/bin/bash
set -e
source="/usr/src/prosody-modules"
target="/usr/local/lib/prosody/custom-modules"
config="/usr/local/etc/prosody/conf.d/01-modules.cfg.lua"
srcExists=
if [ -d ${source} ]; then
srcExists=1
fi
docker-prosody-module-source pullTo ${source}
if [ -z "$srcExists" ]; then
touch ${source}/.docker-delete-me
fi
cd ${source}
usage() {
@ -54,7 +44,3 @@ for ext in $exts; do
new_config=$(cat "${config}" | module="${ext}" perl -0pe 's/(modules_enabled[ ]*=[ ]*{[^}]*)};/$1\n\t"$ENV{module}";\n};/')
echo "${new_config}" > "${config}"
done
if [ -e ${source}/.docker-delete-me ]; then
docker-prosody-module-source deleteFrom ${source}
fi

View file

@ -1,39 +0,0 @@
#!/bin/sh
set -e
dir=$2
usage() {
echo "usage: $0 COMMAND DIR"
echo
echo "Manage prosody-modules source lifecycle."
echo
echo "Commands:"
echo " pullTo extract prosody-module sources into directory ${dir} if not already done."
echo " deleteFrom delete extracted prosody-module sources located into ${dir} if not already done."
echo
}
case "$1" in
pullTo)
mkdir -p "${dir}"
if [ ! -f "${dir}/.docker-pulled" ]; then
wget https://hg.prosody.im/prosody-modules/archive/tip.tar.gz
tar -xzf tip.tar.gz -C "${dir}" --strip-components=1
rm tip.tar.gz
touch "${dir}/.docker-pulled"
fi
;;
deleteFrom)
rm -rf "${dir}"
;;
*)
usage
exit 1
;;
esac

9
download-prosody-modules.bash Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
dir="/usr/src/prosody-modules"
mkdir -p "${dir}"
wget https://hg.prosody.im/prosody-modules/archive/tip.tar.gz
tar -xzf tip.tar.gz -C "${dir}" --strip-components=1
rm tip.tar.gz