From 69aa02fcdc618f472a0115bac9c72bdd827de34d Mon Sep 17 00:00:00 2001 From: meskio Date: Mon, 19 Dec 2022 01:14:49 +0100 Subject: [PATCH] Add support for themes and plugins --- Dockerfile | 26 +++++++++++++++++++++++--- plugins | 1 + themes | 1 + version | 14 +++++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 plugins create mode 100644 themes diff --git a/Dockerfile b/Dockerfile index 2251053..ed4b13d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM registry.sindominio.net/nginx-php RUN apt-get update && \ apt-get -qy install --no-install-recommends \ - gnupg ca-certificates less \ - php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-redis && \ + gnupg ca-certificates less curl jq unzip wget \ + php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-redis && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -23,7 +23,27 @@ WORKDIR /app # install wordpress RUN wp --allow-root core download ADD wp-config.php /app/ -# TODO: install themes and plugins + +# install themes +ADD themes /app/ +RUN cd wp-content/themes && \ + for theme in `cat /app/themes`; do \ + DOWNLOAD_URL=`curl "https://api.wordpress.org/themes/info/1.1/?action=theme_information&request\[slug\]=$theme" |jq -r '.download_link'` && \ + wget -O theme.zip $DOWNLOAD_URL && \ + unzip theme.zip && \ + rm theme.zip; \ + done + +# install plugins +ADD plugins /app/ +RUN cd wp-content/plugins && \ + for plugin in `cat /app/plugins`; do \ + DOWNLOAD_URL=`curl "https://api.wordpress.org/plugins/info/1.0/$plugin.json" |jq -r '.download_link'` && \ + wget -O plugin.zip $DOWNLOAD_URL && \ + unzip plugin.zip && \ + rm plugin.zip; \ + done + VOLUME /app/wp-content/uploads diff --git a/plugins b/plugins new file mode 100644 index 0000000..ef2a714 --- /dev/null +++ b/plugins @@ -0,0 +1 @@ +polylang diff --git a/themes b/themes new file mode 100644 index 0000000..6cc5b1b --- /dev/null +++ b/themes @@ -0,0 +1 @@ +customizr diff --git a/version b/version index 31ee103..279c992 100755 --- a/version +++ b/version @@ -5,4 +5,16 @@ WP=`curl -s https://api.wordpress.org/core/version-check/1.7/ |jq -r '.offers[0] WP_CLI=`curl -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar |sha256sum |awk '{ print $1 }'` -echo "$WP:$WP_CLI" +echo -n "$WP:$WP_CLI" + +for theme in `cat themes` +do + VERSION=`curl -s "https://api.wordpress.org/themes/info/1.1/?action=theme_information&request\[slug\]=$theme" |jq -r '.version'` + echo -n :$theme-$VERSION +done + +for plugin in `cat plugins` +do + VERSION=`curl -s "https://api.wordpress.org/plugins/info/1.0/$plugin.json" |jq -r '.version'` + echo -n :$plugin-$VERSION +done