diff --git a/Dockerfile b/Dockerfile index ed4b13d..2bc85c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,22 +28,51 @@ ADD wp-config.php /app/ 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; \ + DOWNLOAD_URL=`curl -s "https://api.wordpress.org/themes/info/1.1/?action=theme_information&request\[slug\]=$theme" |jq -r '.download_link'` && \ + wget -q -O theme.zip $DOWNLOAD_URL && \ + unzip -q 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 && \ + DOWNLOAD_URL=`curl -s "https://api.wordpress.org/plugins/info/1.0/$plugin.json" |jq -r '.download_link'` && \ + wget -q -O plugin.zip $DOWNLOAD_URL && \ + unzip -q plugin.zip && \ rm plugin.zip; \ done +# install languages (core, plugins, themes) +ADD languages /app/ +RUN mkdir -p wp-content/languages wp-content/languages/plugins wp-content/languages/themes && \ + WP_VERSION=$(wp --allow-root core version) && \ + for language in `cat /app/languages`; do \ + cd /app/wp-content/languages && \ + echo "Install Language Files $language" && \ + DOWNLOAD_URL=`curl -s "https://api.wordpress.org/translations/core/1.0/?version=$WP_VERSION" | jq -r '.translations[] | select(.language=="'$language'").package '` && \ + [ -z $DOWNLOAD_URL ] && echo "Download language file for $language not exist" && \ + [ -z $DOWNLOAD_URL ] || wget -q -O language.zip $DOWNLOAD_URL && \ + [ -f language.zip ] && unzip -q language.zip && \ + [ -f language.zip ] && rm language.zip && \ + cd plugins && \ + for plugin in `cat /app/plugins`; do \ + DOWNLOAD_URL=`curl -s "https://api.wordpress.org/translations/plugins/1.0/?slug=$plugin" | jq -r '.translations[] | select(.language=="'$language'").package '` && \ + [ -z $DOWNLOAD_URL ] && echo "Download language file for $plugin : $language not exist" && \ + [ -z $DOWNLOAD_URL ] || wget -q -O language.zip $DOWNLOAD_URL && \ + [ -z $DOWNLOAD_URL ] || unzip -q language.zip && \ + [ -z $DOWNLOAD_URL ] || rm language.zip; \ + done && \ + cd ../themes && \ + for theme in `cat /app/themes`; do \ + DOWNLOAD_URL=`curl -s "https://api.wordpress.org/translations/themes/1.0/?slug=$theme" | jq -r '.translations[] | select(.language=="'$language'").package '` && \ + [ -z $DOWNLOAD_URL ] && echo "Download language file for $theme : $language not exist" && \ + [ -z $DOWNLOAD_URL ] || wget -q -O language.zip $DOWNLOAD_URL && \ + [ -z $DOWNLOAD_URL ] || unzip -q language.zip && \ + [ -z $DOWNLOAD_URL ] || rm language.zip; \ + done; \ + done VOLUME /app/wp-content/uploads diff --git a/languages b/languages new file mode 100644 index 0000000..6cb7aaf --- /dev/null +++ b/languages @@ -0,0 +1,10 @@ +es_ES +ca +de_DE +en_GB +en_US +es_MX +eu +fr_FR +gl_ES +zh_CN