Create Wordpess Docker with Soundmap Plugin preinstalled
This commit is contained in:
commit
76906d9b8a
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "wordpress/plugins/soundmap"]
|
||||
path = wordpress/plugins/soundmap
|
||||
url = https://git.audio-lab.org/lrullo/soundmap
|
49
Dockerfile
Normal file
49
Dockerfile
Normal file
@ -0,0 +1,49 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
ENV TZ=Europe/Madrid
|
||||
|
||||
ARG PHP_VERSION=8.1
|
||||
|
||||
RUN apt update && apt -y upgrade
|
||||
RUN apt -y install lsb-release ca-certificates curl git
|
||||
RUN curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
|
||||
RUN sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -qy install \
|
||||
php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php${PHP_VERSION}-xmlrpc php${PHP_VERSION}-soap php${PHP_VERSION}-intl php${PHP_VERSION}-zip php${PHP_VERSION}-redis \
|
||||
wget rsync sed curl tar ca-certificates less \
|
||||
mariadb-client && \
|
||||
apt-get clean
|
||||
|
||||
|
||||
COPY config/php-fpm-wordpress.conf /tmp/www.conf
|
||||
|
||||
RUN cp /tmp/www.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \
|
||||
ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm && \
|
||||
sed -i '/^error_log/cerror_log = /dev/stderr' /etc/php/${PHP_VERSION}/fpm/php-fpm.conf && \
|
||||
sed -i '/^log_errors/clog_errors = Off' /etc/php/${PHP_VERSION}/fpm/php-fpm.conf && \
|
||||
sed -i '/^pid/cpid = /tmp/php${PHP_VERSION}-fpm.pid' /etc/php/${PHP_VERSION}/fpm/php-fpm.conf
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN curl -s -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
||||
chmod +x wp-cli.phar && \
|
||||
mv wp-cli.phar /usr/local/bin/wp
|
||||
|
||||
WORKDIR /app/wordpress
|
||||
|
||||
RUN wp core download --allow-root
|
||||
|
||||
ADD wordpress /tmp/wordpress
|
||||
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
VOLUME /app
|
||||
|
||||
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/sbin/php-fpm","--nodaemonize","-O"]
|
54
README.md
Normal file
54
README.md
Normal file
@ -0,0 +1,54 @@
|
||||
# Simple custom template for a clean Wordpress installation.
|
||||
|
||||
## Pre
|
||||
|
||||
$ mkdir data db
|
||||
$ cp env.sample .env
|
||||
$ vim .env
|
||||
|
||||
Customize parameters
|
||||
|
||||
## Build
|
||||
|
||||
$ docker-compose build
|
||||
|
||||
## Run
|
||||
|
||||
$ docker-compose up -d
|
||||
|
||||
Access:
|
||||
|
||||
$ w3m http://localhost:<nginx_port>
|
||||
|
||||
## Config
|
||||
|
||||
Database credentials may edit on _.env_ file.
|
||||
|
||||
## Auto update Wordpress
|
||||
|
||||
User crontab on your hoster server.
|
||||
|
||||
Use this script as template:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
echo "Update Wordrpress"
|
||||
docker-compose exec wordpress wp theme update --all --path="/app/wordpress/"
|
||||
docker-compose exec wordpress wp plugin update --all --path="/app/wordpress/"
|
||||
docker-compose exec wordpress wp core update --path="/app/wordpress/"
|
||||
```
|
||||
|
||||
## Backups
|
||||
|
||||
docker-compose exec db mysqldump --database <MYSQL_DATABASE> > <custom_path>/<dump>.sql
|
||||
|
||||
## Restore
|
||||
|
||||
Database restore, like this examples:
|
||||
|
||||
$ cat <dump>.sql | docker-compose exec db mysql -u <db_user> -p<db_pass> <database>
|
||||
|
||||
Data restore, bulk to volume directory, like:
|
||||
|
||||
$ rsync -avz <backup_wordpress_dir> /var/lib/docker/volumes/<docker_wordpress_volume>/_data/wordpress/
|
38
config/nginx-wordpress.conf
Normal file
38
config/nginx-wordpress.conf
Normal file
@ -0,0 +1,38 @@
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
include snippets/snakeoil.conf;
|
||||
|
||||
server_name _;
|
||||
|
||||
root /app/wordpress;
|
||||
index index.php index.html;
|
||||
|
||||
client_max_body_size 25M;
|
||||
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* /(?:uploads|files)/.*\.php$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args ;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_pass wordpress:9000;
|
||||
}
|
||||
|
||||
access_log /app/log/wordpress.access.log;
|
||||
error_log /app/log/wordpress.error.log;
|
||||
}
|
||||
|
61
config/nginx.conf
Normal file
61
config/nginx.conf
Normal file
@ -0,0 +1,61 @@
|
||||
worker_processes auto;
|
||||
pid /run/nginx/nginx.pid;
|
||||
error_log stderr info;
|
||||
daemon off;
|
||||
master_process off;
|
||||
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
server_tokens off;
|
||||
|
||||
server_names_hash_bucket_size 128;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /dev/stdout;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
#include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
|
||||
|
78
config/nginx.conf.alpine
Normal file
78
config/nginx.conf.alpine
Normal file
@ -0,0 +1,78 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
root /app/wordpress/;
|
||||
|
||||
index index.php;
|
||||
|
||||
server_name _;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args ;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass wordpress:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
fastcgi_param REMOTE_ADDR $http_x_real_ip;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
}
|
||||
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
||||
expires max;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 443 ssl http2 default_server;
|
||||
listen [::]:443 ssl http2 default_server;
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/certs/nginx.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx.key;
|
||||
|
||||
root /app/wordpress/;
|
||||
|
||||
index index.php;
|
||||
|
||||
server_name _;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args ;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass wordpress:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
fastcgi_param REMOTE_ADDR $http_x_real_ip;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
}
|
||||
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
||||
expires max;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
}
|
25
config/php-fpm-wordpress.conf
Normal file
25
config/php-fpm-wordpress.conf
Normal file
@ -0,0 +1,25 @@
|
||||
[www]
|
||||
|
||||
user = www-data
|
||||
group = www-data
|
||||
listen = 9000
|
||||
|
||||
listen.owner = www-data
|
||||
listen.group = www-data
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
access.log = /dev/stdout
|
||||
catch_workers_output = yes
|
||||
php_admin_value[error_log] = /dev/stderr
|
||||
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
|
||||
;php_admin_value[error_log] = /app/log/php-fpm.log
|
||||
php_admin_flag[log_errors] = off
|
||||
php_flag[display_errors] = off
|
||||
php_admin_value[allow_url_fopen] = off
|
||||
php_admin_value[upload_max_filesize] = 50M
|
||||
php_admin_value[post_max_size] = 50M
|
50
docker-compose.yml
Normal file
50
docker-compose.yml
Normal file
@ -0,0 +1,50 @@
|
||||
version: '2.4'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mariadb
|
||||
user: 1000:1000
|
||||
restart: always
|
||||
volumes:
|
||||
- ./db:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_DATABASE
|
||||
- MYSQL_USER
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD
|
||||
- MYSQL_PASSWORD
|
||||
|
||||
wordpress:
|
||||
image: registry.audio-lab.org/wordpress
|
||||
build: .
|
||||
user: 1000:1000
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- ./data:/app
|
||||
restart: always
|
||||
links:
|
||||
- db
|
||||
environment:
|
||||
- MYSQL_DATABASE
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_HOST
|
||||
- WP_USER
|
||||
- WP_PASS
|
||||
- WP_EMAIL
|
||||
- WP_TITLE
|
||||
- WP_URL
|
||||
|
||||
|
||||
nginx:
|
||||
image: registry.sindominio.net/nginx
|
||||
ports:
|
||||
- ${NGINX_PORT}:443
|
||||
volumes:
|
||||
#- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./config/nginx-wordpress.conf:/etc/nginx/conf.d/wordpress.conf:ro
|
||||
- ./data:/app
|
||||
restart: always
|
||||
links:
|
||||
- wordpress
|
59
entrypoint.sh
Executable file
59
entrypoint.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e;
|
||||
|
||||
export WORDPRESS_ROOT=/app/wordpress
|
||||
|
||||
install() {
|
||||
echo "Install Wordpress $WORDPRESS_ROOT"
|
||||
mkdir -p $WORDPRESS_ROOT
|
||||
cd $WORDPRESS_ROOT
|
||||
wp core download
|
||||
config
|
||||
}
|
||||
|
||||
install_themes() {
|
||||
echo "Install Themes"
|
||||
rsync -avz /tmp/wordpress/themes/ /app/wordpress/wp-content/themes/
|
||||
}
|
||||
|
||||
install_plugins() {
|
||||
echo "Install Plugins"
|
||||
rsync -avz /tmp/wordpress/plugins/ /app/wordpress/wp-content/plugins/
|
||||
}
|
||||
|
||||
config() {
|
||||
echo "Config Wordpress $WORDPRESS_ROOT"
|
||||
cd $WORDPRESS_ROOT
|
||||
echo "Create Config"
|
||||
wp config create --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=$MYSQL_HOST --locale=es_ES
|
||||
echo "Install Worpdress"
|
||||
if ! wp core is-installed; then
|
||||
wp core install --url="$WP_URL" --title="$WP_TITLE" --admin_user="$WP_USER" --admin_password="$WP_PASS" --admin_email="$WP_EMAIL" --path="/app/wordpress/"
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
echo "Update Wordpress"
|
||||
cd $WORDPRESS_ROOT
|
||||
#https://make.wordpress.org/cli/handbook/
|
||||
wp core update --path="/app/wordpress/"
|
||||
#wp plugin update --all --path="/app/wordpress/"
|
||||
#wp theme update --all --path="/app/wordpress/"
|
||||
}
|
||||
|
||||
#mkdir -p /app/log/
|
||||
|
||||
[ -d /app/wordpress ] || install
|
||||
[ -f /app/wordpress/wp-config.php ] || config
|
||||
|
||||
# WP-CLI install
|
||||
# https://www.cloudways.com/blog/install-wordpress-using-wp-cli/
|
||||
|
||||
update
|
||||
#install_themes
|
||||
install_plugins
|
||||
|
||||
echo "Starting Wordpress"
|
||||
|
||||
exec $@
|
14
env.sample
Normal file
14
env.sample
Normal file
@ -0,0 +1,14 @@
|
||||
MYSQL_DATABASE=wordpress
|
||||
MYSQL_USER=wordpress
|
||||
MYSQL_RANDOM_ROOT_PASSWORD=1
|
||||
MYSQL_PASSWORD=wordpress
|
||||
MYSQL_HOST=db
|
||||
|
||||
NGINX_PORT=8443
|
||||
USER_GROUP=1000:1000
|
||||
|
||||
WP_USER=admin
|
||||
WP_PASS=admin
|
||||
WP_EMAIL=real@mail.org
|
||||
WP_TITLE=Wordpress Title
|
||||
WP_URL=http://docker:8180
|
1
wordpress/plugins/soundmap
Submodule
1
wordpress/plugins/soundmap
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e5581e28360bf44ff216f70e409ba52a1b3ef7ef
|
Loading…
Reference in New Issue
Block a user