-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing and improving build scripts and docs (#72)
* Fixing and improving build scripts and docs * Updating composer packages * Removing composer hash check
- Loading branch information
1 parent
a00e054
commit 1881c60
Showing
14 changed files
with
251 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM ubuntu:lunar | ||
|
||
EXPOSE 80 | ||
|
||
ENV NR_PHP_AGENT_URL 'https://download.newrelic.com/php_agent/archive/10.9.0.324/newrelic-php5-10.9.0.324-linux.tar.gz' | ||
|
||
ENV INSTALL_GHOSTSCRIPT true | ||
|
||
ENV PHP_UPLOAD_MAX_FILESIZE '256M' | ||
ENV PHP_POST_MAX_SIZE '384M' | ||
ENV PHP_MEMORY_LIMIT '512M' | ||
ENV PHP_MAX_EXECUTION_TIME '240' | ||
|
||
# The "Hardening WordPress" article at https://wordpress.org/documentation/article/hardening-wordpress/ | ||
# recommends 755 and 644. | ||
ENV FILE_OWNER 'wp-services' | ||
ENV FILE_GROUP 'www-data' | ||
ENV FILE_MODE 0644 | ||
ENV DIRECTORY_MODE 0644 | ||
RUN useradd wp-services -r -m --shell=/bin/false --uid=699 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install PHP and related packages, plus locales | ||
COPY ./bin/install_packages.sh /root/install_packages.sh | ||
RUN bash /root/install_packages.sh | ||
ENV LANG en_US.utf8 | ||
|
||
# Install Ghostscript | ||
COPY ./bin/install_ghostscript.sh /root/install_ghostscript.sh | ||
RUN if [ $INSTALL_GHOSTSCRIPT ]; then bash /root/install_ghostscript.sh; fi | ||
|
||
# Copy over our nginx site config | ||
COPY ./nginx_config/default_site /etc/nginx/sites-enabled/default | ||
|
||
# Run further nginx configurations | ||
COPY bin/configure_nginx.sh /root/configure_nginx.sh | ||
RUN /root/configure_nginx.sh | ||
|
||
WORKDIR /var/www/html | ||
|
||
COPY mu-plugins/ /root/mu-plugins/ | ||
|
||
COPY bin/* /root/ | ||
|
||
ENTRYPOINT /root/entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/bin/bash | ||
|
||
sed -i -e "s/access_log \/var\/log\/nginx\/access.log;/access_log \/dev\/stdout;/" /etc/nginx/nginx.conf | ||
sed -i -e "s/error_log \/var\/log\/nginx\/error.log;/error_log \/dev\/stderr;/" /etc/nginx/nginx.conf | ||
# sed -i -e "s/access_log \/var\/log\/nginx\/access.log;/access_log \/dev\/stdout;/" /etc/nginx/nginx.conf | ||
# sed -i -e "s/error_log \/var\/log\/nginx\/error.log;/error_log \/dev\/stderr;/" /etc/nginx/nginx.conf | ||
|
||
if [ $PHP_MAX_EXECUTION_TIME ] | ||
then | ||
sed -i -e "s/fastcgi_read_timeout 30;/fastcgi_read_timeout ${PHP_MAX_EXECUTION_TIME};/" /etc/nginx/sites-enabled/default | ||
sed -i -e "s/fastcgi_send_timeout 30;/fastcgi_send_timeout ${PHP_MAX_EXECUTION_TIME};/" /etc/nginx/sites-enabled/default | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,18 +49,18 @@ then | |
wp config set DISALLOW_FILE_EDIT true --raw --allow-root | ||
wp config set WP_AUTO_UPDATE_CORE false --raw --allow-root | ||
|
||
if [ $WP_DEBUG ] | ||
if [ "$WP_DEBUG" ] | ||
then | ||
wp config set WP_DEBUG true --raw --allow-root | ||
wp config set WP_DEBUG_DISPLAY false --raw --allow-root | ||
fi | ||
|
||
if [ $WP_SCRIPT_DEBUG ] | ||
if [ "$WP_SCRIPT_DEBUG" ] | ||
then | ||
wp config set SCRIPT_DEBUG false --raw --allow-root | ||
fi | ||
|
||
if [ -v $WP_MEMORY_LIMIT ] | ||
if [ "$WP_MEMORY_LIMIT" ] | ||
then | ||
wp config set WP_MEMORY_LIMIT "$WP_MEMORY_LIMIT" --allow-root | ||
wp config set WP_MAX_MEMORY_LIMIT "$WP_MEMORY_LIMIT" --allow-root | ||
|
@@ -69,54 +69,62 @@ then | |
wp config set WP_MAX_MEMORY_LIMIT "ini_get( 'memory_limit' )" --raw --allow-root | ||
fi | ||
|
||
if [ $DISABLE_WP_CRON ] | ||
if [ "$DISABLE_WP_CRON" ] | ||
then | ||
wp config set DISABLE_WP_CRON true --allow-root | ||
fi | ||
|
||
if [ $WP_UPLOADS_URL ] | ||
if [ "$WP_UPLOADS_URL" ] | ||
then | ||
wp config set UPLOADS_URL "$WP_UPLOADS_URL" --allow-root | ||
fi | ||
|
||
# Enable Memcached object storage | ||
export MEMCACHED_HOST=$(jq -r '.memcached_servers[0]' /secrets/credentials.json) | ||
if [ $MEMCACHED_HOST ] | ||
memcached_host=$(jq -r '.memcached_servers[0]' /secrets/credentials.json) | ||
if [ "$memcached_host" ] | ||
then | ||
sed -i "/Add any custom values between this line/a \$memcached_servers = array( 'default' => \$credentials->memcached_servers );" wp-config.php | ||
curl -s https://plugins.trac.wordpress.org/export/HEAD/memcached/trunk/object-cache.php > ./wp-content/object-cache.php | ||
chmod $FILE_MODE ./wp-content/object-cache.php | ||
chown $FILE_OWNER ./wp-content/object-cache.php | ||
if [ "$FILE_MODE" ] | ||
then | ||
chmod "$FILE_MODE" ./wp-content/object-cache.php | ||
fi | ||
if [ "$FILE_OWNER" ] | ||
then | ||
chown "$FILE_OWNER" ./wp-content/object-cache.php | ||
fi | ||
fi | ||
|
||
if [ $WP_CONTENT_URL ] | ||
if [ "$WP_CONTENT_URL" ] | ||
then | ||
wp config set WP_CONTENT_URL "$WP_CONTENT_URL" --allow-root | ||
fi | ||
fi | ||
|
||
if [ $WP_THEME_INSTALL ] | ||
then | ||
wp theme install "$WP_THEME_INSTALL" --allow-root | ||
fi | ||
wp core install --url="localhost" --title="DockPress Site" --admin_user="admin" --admin_password="password" --admin_email="[email protected]" --skip-email --allow-root | ||
|
||
if [ $WP_THEME_ACTIVATE ] | ||
then | ||
wp theme activate "$WP_THEME_ACTIVATE" --allow-root | ||
fi | ||
if [ "$WP_THEME_INSTALL" ] | ||
then | ||
wp theme install "$WP_THEME_INSTALL" --allow-root | ||
fi | ||
|
||
if [ $WP_PLUGIN_INSTALL ] | ||
then | ||
wp plugin install "$WP_PLUGIN_INSTALL" --allow-root | ||
fi | ||
if [ "$WP_THEME_ACTIVATE" ] | ||
then | ||
wp theme activate "$WP_THEME_ACTIVATE" --allow-root | ||
fi | ||
|
||
if [ $WP_PLUGIN_ACTIVATE ] | ||
then | ||
wp plugin activate "$WP_PLUGIN_ACTIVATE" --allow-root | ||
fi | ||
if [ "$WP_PLUGIN_INSTALL" ] | ||
then | ||
wp plugin install "$WP_PLUGIN_INSTALL" --allow-root | ||
fi | ||
|
||
if [ "$WP_PLUGIN_ACTIVATE" ] | ||
then | ||
wp plugin activate "$WP_PLUGIN_ACTIVATE" --allow-root | ||
fi | ||
|
||
# Remove crapware plugins from the WordPress installation | ||
if [ $REMOVE_CRAP_PLUGINS ] | ||
if [ "$REMOVE_CRAP_PLUGINS" ] | ||
then | ||
rm -rf wp-content/plugins/akismet/ | ||
rm -rf wp-content/plugins/hello.php | ||
|
@@ -126,5 +134,4 @@ if [ ! -d wp-content/uploads ] | |
then | ||
echo "📁 Creating uploads directory" | ||
mkdir wp-content/uploads | ||
chmod a+rw wp-content/uploads | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
#!/bin/bash | ||
|
||
chown -R $FILE_OWNER . | ||
find . -type f -not -path "./.git/*" -not -path "./wp-content/uploads/*" -exec chmod $DIRECTORY_MODE {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./wp-content/uploads/*" -exec chmod $FILE_MODE {} \; | ||
if [ "$FILE_OWNER" ] | ||
then | ||
if [ ! "$FILE_GROUP" ] | ||
then | ||
FILE_GROUP=$FILE_OWNER | ||
fi | ||
chown -R "$FILE_OWNER:$FILE_GROUP" . | ||
fi | ||
|
||
if [ "$DIRECTORY_MODE" ] | ||
then | ||
find . -type d -not -path "./.git/*" -not -path "./wp-content/uploads/*" -exec chmod "$DIRECTORY_MODE" {} \; | ||
fi | ||
|
||
if [ "$FILE_MODE" ] | ||
then | ||
find . -type f -not -path "./.git/*" -not -path "./wp-content/uploads/*" -exec chmod "$FILE_MODE" {} \; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
dockpress: | ||
image: dockpress | ||
volumes: | ||
- ./secrets:/secrets | ||
ports: | ||
- 80:80 | ||
mariadb: | ||
image: mariadb | ||
restart: always | ||
ports: | ||
- 3306:3306 | ||
environment: | ||
- MARIADB_DATABASE=wordpress | ||
- MARIADB_USER=wordpress | ||
- MARIADB_PASSWORD=password | ||
- MARIADB_ROOT_PASSWORD=password | ||
memcached: | ||
image: memcached | ||
ports: | ||
- 11211:11211 |
Oops, something went wrong.