diff --git a/Dockerfile b/Dockerfile index 6fb46a5..f1b446e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/docker-prosody-module-copy b/docker-prosody-module-copy.bash similarity index 71% rename from docker-prosody-module-copy rename to docker-prosody-module-copy.bash index fe7c7ab..954edeb 100755 --- a/docker-prosody-module-copy +++ b/docker-prosody-module-copy.bash @@ -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 diff --git a/docker-prosody-module-install b/docker-prosody-module-install.bash similarity index 77% rename from docker-prosody-module-install rename to docker-prosody-module-install.bash index 6464399..337c8c7 100755 --- a/docker-prosody-module-install +++ b/docker-prosody-module-install.bash @@ -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 diff --git a/docker-prosody-module-source b/docker-prosody-module-source deleted file mode 100755 index 9fe22ed..0000000 --- a/docker-prosody-module-source +++ /dev/null @@ -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 diff --git a/download-prosody-modules.bash b/download-prosody-modules.bash new file mode 100755 index 0000000..7edb7bd --- /dev/null +++ b/download-prosody-modules.bash @@ -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