Commit 6232adfa authored by Michael Iseard's avatar Michael Iseard
Browse files

Automatically install redis object cache drop in

parent dd3c162d
......@@ -23,6 +23,9 @@ MYSQL_DATABASE=wordpress
# nginx - nginx:latest
NGINX_VERSION=latest
# redis
REDIS_PASSWORD=changeme
# volumes on host
NGINX_CONF_DIR=./nginx
NGINX_LOG_DIR=./logs/nginx
......
......@@ -80,6 +80,9 @@ RUN set ex; \
tar -xzf wordpress.tar.gz -C /usr/src/; \
rm wordpress.tar.gz; \
chown -R www-data:www-data /usr/src/wordpress; \
# install redis object cache
curl -o /usr/src/wordpress/wp-content/object-cache.php https://raw.githubusercontent.com/pantheon-systems/wp-redis/master/object-cache.php; \
#chown -R www-data:www-data /usr/src/wordpress; \
# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root
mkdir wp-content; \
for dir in /usr/src/wordpress/wp-content/*/; do \
......@@ -87,10 +90,7 @@ RUN set ex; \
mkdir "wp-content/$dir"; \
done; \
chown -R www-data:www-data wp-content; \
chmod -R 777 wp-content
VOLUME /var/www/html
chmod -R 777 wp-content;
COPY docker-entrypoint.sh /usr/local/bin/
......
......@@ -52,6 +52,7 @@ services:
- db
volumes:
- ${WORDPRESS_DIR:-./wordpress}:/var/www/html/
- ./object-cache.php:/var/www/html/wp-content/object-cache.php
- ${PHP_UPLOADS:-./php/uploads.ini}:/usr/local/etc/php/conf.d/uploads.ini
environment:
WORDPRESS_DB_NAME: ${MYSQL_DATABASE:-wordpress}
......@@ -61,6 +62,13 @@ services:
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-password}
WORDPRESS_CONFIG_EXTRA: |
define('FS_METHOD', 'direct');
$$redis_server = array(
'host' => 'redis',
'port' => 6379,
'auth' => '2ihJHjk45ff',
'database' => 0, // Optionally use a specific numeric Redis database. Default is 0.
);
restart: always
nginx:
......@@ -102,7 +110,7 @@ services:
redis:
image: redis:alpine
container_name: ${CONTAINER_PREFIX}-redis
command: redis-server --requirepass ${REDIS_PASSWORD}
restart: always
networks:
- default
- web
ports:
- 6379:6379
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment