wordpress-charmers team mailing list archive
-
wordpress-charmers team
-
Mailing list archive
-
Message #00020
Re: [Merge] ~barryprice/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master
Thanks, addressed 2/3, will push a fresh branch and we can discuss the other later today.
Diff comments:
> diff --git a/Dockerfile b/Dockerfile
> new file mode 100644
> index 0000000..38866f4
> --- /dev/null
> +++ b/Dockerfile
> @@ -0,0 +1,55 @@
> +FROM ubuntu:bionic
> +
> +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
> +
> +RUN apt-get update && apt-get -y dist-upgrade \
> + && apt-get --purge autoremove -y \
> + && apt-get clean \
> + && rm -rf /var/lib/apt/lists/*
> +
> +ENV APACHE_CONFDIR=/etc/apache2
> +ENV APACHE_ENVVARS=/etc/apache2/envvars
> +
> +RUN apt-get update \
> + && apt-get install -y --no-install-recommends apache2 \
This particular case just stops the ssl-cert package from being installed (we're not terminating TLS here). I'll add a comment.
> + && rm -rf /var/lib/apt/lists/* \
> + && 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 \
> + && ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \
> + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \
> + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" \
> + && chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
> +
> +RUN echo '<FilesMatch \.php$>' > "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '\tSetHandler application/x-httpd-php' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '</FilesMatch>' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo 'DirectoryIndex disabled' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo 'DirectoryIndex index.php index.html' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '<Directory /var/www/>' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '\tOptions -Indexes' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '\tAllowOverride All' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
> + && echo '</Directory>' >> "$APACHE_CONFDIR/conf-available/docker-php.conf" \
Good idea, thanks. Will do.
> + && a2enconf docker-php
> +
> +RUN apt-get update && apt-get install -y curl php libapache2-mod-php php-mysql php-gd \
> + && apt-get clean \
> + && rm -rf /var/lib/apt/lists/*
> +
> +RUN a2dismod mpm_event \
> + && a2enmod mpm_prefork
> +
> +RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz" \
> + && tar -xzf wordpress.tar.gz -C /usr/src/ \
> + && rm wordpress.tar.gz \
> + && chown -R www-data:www-data /usr/src/wordpress \
> + && rm -rf /var/www/html \
> + && mv /usr/src/wordpress /var/www/html
> +
> +COPY --chown=www-data:www-data ./plugins/ /var/www/html/wp-content/plugins/
> +COPY --chown=www-data:www-data ./themes/ /var/www/html/wp-content/themes/
> +
> +EXPOSE 80
> +CMD apachectl -D FOREGROUND
> diff --git a/Makefile b/Makefile
> new file mode 100644
> index 0000000..92c0edb
> --- /dev/null
> +++ b/Makefile
> @@ -0,0 +1,30 @@
> +build: lint deps
> + @echo "Fetching plugins and themes."
> + @tox -e fetch
> + @echo "Building the image."
> + @docker build . -t wordpress:latest
> + @echo "Pushing to the prod-is-external registry."
> + @docker tag wordpress:latest prod-is-external.docker-registry.canonical.com/wordpress:latest
> + @docker push prod-is-external.docker-registry.canonical.com/wordpress:latest
> +
> +deps:
> + @echo "Checking dependencies are present"
> + which bzr || sudo apt-get install -y bzr
> + which git || sudo apt-get install -y git
There is precedent in a few charm Makefiles, but we can discuss on a call. Leaving in place pending discussion.
> +
> +lint: clean
> + @echo "Normalising python layout with black."
> + @tox -e black
> + @echo "Running flake8"
> + @tox -e lint
> +
> +clean:
> + @echo "Cleaning files"
> + @rm -rf ./.tox
> + @rm -rf ./.pytest_cache
> + @rm -rf ./plugins/*
> + @rm -rf ./themes/*
> + @mkdir -p plugins
> + @mkdir -p themes
> +
> +.PHONY: build lint clean
--
https://code.launchpad.net/~barryprice/charm-k8s-wordpress/+git/wordpress-k8s-image-builder/+merge/377499
Your team Wordpress Charmers is requested to review the proposed merge of ~barryprice/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.
References