diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b8fb57add5b22188d2ded99a72f98a75c53b9f4..2a78f433d9b7d86a16a545f32a6d5b84752611ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,12 +19,9 @@ before_script: only: &build-only changes: - Dockerfile - - entrypoint.sh - - nginx.conf - - opcache.ini + - data/* + - plugins/* - scripts/* - - wp-config.php - - wp.sh script: - docker build . --pull=true diff --git a/Dockerfile b/Dockerfile index 0c793b34eca32c80684f5e0fa508f79120df4734..6ac80d3b9ae9d48dd8d2e35989a0650c678b4906 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG nginx_version=latest FROM nginx:${nginx_version} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill " -COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY data/nginx.conf /etc/nginx/conf.d/default.conf FROM php:7.3-fpm-alpine as deps @@ -20,15 +20,17 @@ ARG wp_version=latest WORKDIR /app ENV WORDPRESS_ROOT=/app -COPY wp.sh /usr/local/bin/wp +COPY scripts/wp.sh /usr/local/bin/wp COPY --from=compile /usr/local/etc/php /usr/local/etc/php COPY --from=compile /usr/local/lib/php /usr/local/lib/php RUN --mount=type=bind,source=scripts/install-wp.sh,target=/stage \ /stage ${wp_version} -COPY opcache.ini /usr/local/etc/php/conf.d/opcache-recommended.ini -COPY wp-config.php /usr/share/wordpress/wp-config.php -COPY entrypoint.sh /bin/entrypoint +COPY plugins/probe.php wp-content/mu-plugins/ +COPY data/fpm.conf /usr/local/etc/php-fpm.d/image.conf +COPY data/opcache.ini /usr/local/etc/php/conf.d/opcache-recommended.ini +COPY data/wp-config.php /usr/share/wordpress/wp-config.php +COPY scripts/entrypoint.sh /bin/entrypoint # PAGER is used by the wp-cli tool, the default 'less' is not installed ENV PAGER=more diff --git a/data/fpm.conf b/data/fpm.conf new file mode 100644 index 0000000000000000000000000000000000000000..20bd27fc785cfb90c09360d2d5f3ef88a32d9eb7 --- /dev/null +++ b/data/fpm.conf @@ -0,0 +1 @@ +access.format = "[%{%Y-%m-%dT%H:%M:%S%z}t] %{REMOTE_ADDR}e %m %{REQUEST_URI}e %s time=%{mili}d ms;" diff --git a/nginx.conf b/data/nginx.conf similarity index 93% rename from nginx.conf rename to data/nginx.conf index 765db67c5d3e0d55f01050d70c0ae332bf0a6ef7..8f5fb750aeaa53137c31a6574d458a33085212ff 100644 --- a/nginx.conf +++ b/data/nginx.conf @@ -3,10 +3,17 @@ map $http_x_forwarded_proto $forwarded_https { https on; } +log_format clear '[$time_iso8601] $remote_addr ' + '$request_method $request_uri $status ' + ' sent=$body_bytes_sent bytes;' + ' referrer=$http_referer;' + ' user-agent=$http_user_agent'; + server { listen 80; server_name _; root /app/static; + access_log /dev/stdout clear; # Consider all private IP addresses safe sources for X-Forwarded-For set_real_ip_from 10.0.0.0/8; diff --git a/opcache.ini b/data/opcache.ini similarity index 100% rename from opcache.ini rename to data/opcache.ini diff --git a/wp-config.php b/data/wp-config.php similarity index 100% rename from wp-config.php rename to data/wp-config.php diff --git a/plugins/probe.php b/plugins/probe.php new file mode 100644 index 0000000000000000000000000000000000000000..5c7dff5b6e7eb9a45007ef17e6a9e35ab8e48669 --- /dev/null +++ b/plugins/probe.php @@ -0,0 +1,18 @@ +