commit d5b26c7f34a4220cdc4ff376ca197736b171bf94 Author: root Date: Sat Feb 26 19:43:43 2022 +0000 Update: SSH/WPCLI/Worpress/... diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..660383a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM registry.sindominio.net/php-fpm + +RUN apt-get update && \ + apt-get -qy install \ + php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip \ + wget less tar curl ca-certificates &&\ + apt-get clean + +RUN mkdir -p /app/ + +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 + +COPY ./config/wp-config-sample.php /tmp/wp-config-sample.php +COPY ./entrypoint.sh /entrypoint.sh + +VOLUME /app/ + +EXPOSE 9000 + +ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ] + +CMD ["/usr/sbin/php-fpm","--nodaemonize"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..d8514d1 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +Simple custom template for a clean Wordpress installation. + +# Config + +Create data directories: + +``` +$ mkdir db data +``` + +Database credentials may edit on ENVIRONMENT on docker-compose.yml or user _.env_ file: + +``` +$ cp .env.sample .env +$ vim .env +``` + +# Add SSH submodule + +``` +$ git submodule add https://git.audio-lab.org/lrullo/sshd.git sshd +``` + +# Build and Pull images + + $ docker-compose pull + $ docker-compose build + +# Run + + $ docker-compose up -d + +# Auto update Wordpress + +User crontab on your hoster server. + +Use this script as template: + +``` +#!/bin/bash + +echo "Update Wordrpress" +docker exec -it docker-wordpress sudo -u wordpress -i -- /app/wp theme update --all --path="/app/wordpress/" +docker exec -it docker-wordpress_1 sudo -u wordpress -i -- /app/wp plugin update --all --path="/app/wordpress/" +docker exec -it docker-wordpress sudo -u wordpress -i -- /app/wp core update --path="/app/wordpress/" +``` diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000..3bbe082 --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,59 @@ +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/*; +} + diff --git a/config/wordpress.conf b/config/wordpress.conf new file mode 100644 index 0000000..d9224b9 --- /dev/null +++ b/config/wordpress.conf @@ -0,0 +1,88 @@ + server { + listen 80; + + root /app/wordpress/; + + index index.php; + + server_name _; + + access_log /var/log/nginx/access.log; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + 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 default_server; + + include snippets/snakeoil.conf; + + root /app/wordpress/; + + index index.php index.html; + + 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; + } + + } + diff --git a/config/wp-config-sample.php b/config/wp-config-sample.php new file mode 100644 index 0000000..f299fdb --- /dev/null +++ b/config/wp-config-sample.php @@ -0,0 +1,16 @@ +> /app/wordpress/wp-config.php; +} + +create_wpconfig() { + if [ -n /app/wordpress/wp-config.php ]; then cp /tmp/wp-config-sample.php /app/wordpress/wp-config.php; fi +} + + +install +create_wpconfig +config + +echo "Starting Wordpress" + +exec $@