← Back to team overview

wordpress-charmers team mailing list archive

[Merge] ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master

 

Thomas Cuthbert has proposed merging ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder/+merge/394385
-- 
Your team Wordpress Charmers is requested to review the proposed merge of ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.
diff --git a/Dockerfile b/Dockerfile
index 66bafe0..1ca1002 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,11 +5,12 @@ FROM ubuntu:${DIST_RELEASE}
 LABEL maintainer="wordpress-charmers@xxxxxxxxxxxxxxxxxxx"
 
 # HTTPS_PROXY used when we RUN curl to download Wordpress itself
-ARG HTTPS_PROXY
 ARG BUILD_DATE
-ARG PKGS_TO_INSTALL
+ARG HTTPS_PROXY
 
-LABEL org.label-schema.build-date=${BUILD_DATE}
+# Launchpad OCI image builds don't support dynamic arg parsing. Skip until
+# https://bugs.launchpad.net/launchpad/+bug/1902010 is resolved.
+#LABEL org.label-schema.build-date=${BUILD_DATE}
 
 ENV APACHE_CONFDIR=/etc/apache2
 ENV APACHE_ENVVARS=/etc/apache2/envvars
@@ -20,7 +21,23 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
 # Update all packages, remove cruft, install required packages, configure apache
 RUN apt-get update && apt-get -y dist-upgrade \
     && apt-get --purge autoremove -y \
-    && apt-get install -y ${PKGS_TO_INSTALL} \
+    && apt-get install -y apache2 \
+    bzr \
+    curl \
+    git \
+    libapache2-mod-php \
+    libgmp-dev \
+    php \
+    php-curl \
+    php-gd \
+    php-gmp \
+    php-mysql \
+    php-symfony-yaml \
+    php-xml \
+    pwgen \
+    python3 \
+    python3-yaml \
+    ssl-cert \
     && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
     && . "$APACHE_ENVVARS" \
     && for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR"; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 777 "$dir";  done \
@@ -47,29 +64,35 @@ RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz"; \
     && rm -rf /var/www/html \
     && mv /usr/src/wordpress /var/www/html
 
+COPY ./files/ /files/
+COPY ./fetcher.py .
+RUN mkdir -p /files/themes /files/plugins
+RUN export HTTP_PROXY="" HTTPS_PROXY="" && ./fetcher.py
 # Copy our collected themes and plugins into the appropriate paths
-COPY --chown=www-data:www-data ./files/plugins/ /var/www/html/wp-content/plugins/
-COPY --chown=www-data:www-data ./files/themes/ /var/www/html/wp-content/themes/
+RUN cp -r /files/plugins/* /var/www/html/wp-content/plugins/
+RUN cp -r /files/themes/* /var/www/html/wp-content/themes/
 
 # wp-info.php contains template variables which our ENTRYPOINT script will populate
-COPY ./files/wp-info.php ./files/wp-config.php /var/www/html/
+RUN install -D /files/wp-info.php /var/www/html/wp-info.php
+RUN install -D /files/wp-config.php /var/www/html/wp-config.php
+RUN chown -R www-data:www-data /var/www/html
 
 # Copy our helper scripts and their wrapper into their own directory
-COPY ./files/_add_option.php \
-    ./files/_enable_plugin.php \
-    ./files/_get_option.php \
-    ./files/plugin_handler.py \
-    ./files/ready.sh \
-    /srv/wordpress-helpers/
+RUN install /files/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
+
+RUN install -t /srv/wordpress-helpers/ -D /files/_add_option.php \
+    /files/_enable_plugin.php \
+    /files/_get_option.php \
+    /files/plugin_handler.py \
+    /files/ready.sh
 
 # Make the wrapper executable
 RUN chmod 0755 /srv/wordpress-helpers/plugin_handler.py
 RUN chmod 0755 /srv/wordpress-helpers/ready.sh
-
-# entrypoint script will configure Wordpress based on env variables
-COPY ./files/docker-entrypoint.sh /usr/local/bin/
 RUN chmod 0755 /usr/local/bin/docker-entrypoint.sh
 
+RUN rm -r /files
+
 # Port 80 only, TLS will terminate elsewhere
 EXPOSE 80
 
diff --git a/fetcher.py b/fetcher.py
index ea1da60..5ce0b50 100755
--- a/fetcher.py
+++ b/fetcher.py
@@ -46,26 +46,26 @@ zip_plugins_to_get = {
 
 branch_plugins_to_get = {
     # please keep these in alphabetical order
-    'launchpad-integration': {'url': 'lp:wordpress-launchpad-integration'},
-    'openstack-objectstorage': {'url': 'lp:~canonical-sysadmins/wordpress/openstack-objectstorage-k8s'},
-    'teams-integration': {'url': 'lp:wordpress-teams-integration'},
-    'xubuntu-team-members': {'url': 'lp:~canonical-sysadmins/wordpress/wp-plugin-xubuntu-team-members'},
+    'launchpad-integration': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress-launchpad-integration/+git/wordpress-launchpad-integration'},
+    'openstack-objectstorage': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/openstack-objectstorage-k8s'},
+    'teams-integration': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress-teams-integration/+git/wordpress-teams-integration'},
+    'xubuntu-team-members': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-plugin-xubuntu-team-members'},
 }
 
 branch_themes_to_get = {
     # please keep these in alphabetical order
     'fruitful': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-fruitful'},
-    'light-wordpress-theme': {'url': 'lp:ubuntu-community-webthemes/light-wordpress-theme'},
-    'mscom': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-mscom'},
-    'twentyeleven': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-twentyeleven'},
-    'ubuntu-cloud-website': {'url': 'lp:ubuntu-cloud-website'},
-    'ubuntu-community': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-ubuntu-community'},
-    'ubuntu-community-wordpress-theme': {'url': 'lp:ubuntu-community-wordpress-theme'},
-    'ubuntu-fi-new': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-ubuntu-fi'},
-    'ubuntu-light': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-ubuntu-light'},
-    'ubuntustudio-wp': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-ubuntustudio-wp'},
-    'wordpress_launchpad': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-launchpad'},
-    'xubuntu-theme': {'url': 'lp:~canonical-sysadmins/wordpress/wp-theme-xubuntu-website'},
+    'light-wordpress-theme': {'url': 'https://git.launchpad.net/~canonical-sysadmins/ubuntu-community-webthemes/+git/light-wordpress-theme'},
+    'mscom': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-mscom'},
+    'twentyeleven': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-twentyeleven'},
+    'ubuntu-cloud-website': {'url': 'https://git.launchpad.net/~canonical-sysadmins/ubuntu-cloud-website/+git/ubuntu-cloud-website'},
+    'ubuntu-community': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-ubuntu-community'},
+    'ubuntu-community-wordpress-theme': {'url': 'https://git.launchpad.net/~canonical-sysadmins/ubuntu-community-wordpress-theme/+git/ubuntu-community-wordpress-theme'},
+    'ubuntu-fi-new': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-ubuntu-fi'},
+    'ubuntu-light': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-ubuntu-light'},
+    'ubuntustudio-wp': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-ubuntustudio-wp'},
+    'wordpress_launchpad': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-launchpad'},
+    'xubuntu-theme': {'url': 'https://git.launchpad.net/~canonical-sysadmins/wordpress/+git/wp-theme-xubuntu-website'},
 }
 
 
@@ -102,7 +102,7 @@ def get_plugins(zip_plugins, branch_plugins):
         else:
             print("ERROR: Don't know how to clone {}".format(url))
             exit(1)
-        _ = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.PIPE)
+        _ = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
 
 
 def get_themes(branch_themes):
@@ -125,7 +125,7 @@ def get_themes(branch_themes):
         else:
             print("ERROR: Don't know how to clone {}".format(url))
             exit(1)
-        _ = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.PIPE)
+        _ = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
 
 
 if __name__ == '__main__':

Follow ups