Wordpress Universal Docker Compose

This commit is contained in:
Siroco 2021-03-17 00:09:04 +01:00
commit d886c5357d
4 changed files with 119 additions and 0 deletions

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM debian:buster-slim as build
RUN apt-get update && \
apt-get -qy install \
php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip \
sudo &&\
apt-get clean
RUN useradd wordpress
COPY wordpress.conf /etc/php/7.3/fpm/pool.d/www.conf
RUN mkdir /run/php/
#RUN mkdir logs
#USER wordpress
WORKDIR app
RUN wget -O wordpress.tar.gz "https://wordpress.org/latest.tar.gz"
RUN wget https://wordpress.org/latest.tar.gz
RUN tar -xzf wordpress.tar.gz
RUN rm latest.tar.gz
#ADD wordpress_files/wp-config.php /app/wordpress/wp-config.php
#ADD wordpress_files/themes/ /app/wordpress/wp-content/themes/
#ADD wordpress_files/plugins/ /app/wordpress/wp-content/plugins/
#ADD wordpress_files/sunrise.php /app/wordpress/wp-content/sunrise.php
RUN chown -R wordpress:wordpress /app/wordpress
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
RUN chmod +x wp-cli.phar
RUN mv wp-cli.phar wp
## ESTO EN UN CRON DAILY
#RUN sudo -u wordpress /app/wp theme update --all --path="/app/wordpress/"
#RUN ./wp plugin update --all --path="/app/wordpress/"
#RUN ./wp core update --all --path="/app/wordpress/"
#USER root
EXPOSE 9000
VOLUME /app/
CMD ["/usr/sbin/php-fpm7.3","--nodaemonize"]]

33
docker-compose.yml Normal file
View File

@ -0,0 +1,33 @@
version: '3'
volumes:
db:
data:
services:
db:
image: mariadb
restart: always
volumes:
- db:/var/lib/mysql
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_RANDOM_ROOT_PASSWORD: '1'
MYSQL_PASSWORD: wordpress
wordpress:
build: .
volumes:
- data:/app/wordpress
restart: always
nginx:
image: nginx:alpine
ports:
- 8180:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
volumes_from:
- wordpress
restart: always

30
nginx.conf Normal file
View File

@ -0,0 +1,30 @@
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;
}
}

14
wordpress.conf Normal file
View File

@ -0,0 +1,14 @@
[wordpress]
user = wordpress
group = wordpress
listen = 9000
listen.owner = wordpress
listen.group = wordpress
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3