This commit is contained in:
Willem Haffmans 2025-05-21 22:51:26 +02:00
parent 0b15a19325
commit 8ded6e8358
10 changed files with 66 additions and 24 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
data/

View File

@ -20,17 +20,21 @@ services:
- data_mariadb:/var/lib/mysql
# nginx:
# restart: always
# build:
# context: ./requirements/nginx
# dockerfile: Dockerfile
# ports:
# - '443:443'
# networks:
# - docker-network
# volumes:
# - data_wordpress:/var/www/html
nginx:
restart: always
container_name: nginx
build:
context: ./requirements/nginx
dockerfile: Dockerfile
depends_on:
- wordpress
ports:
- '443:443'
- '80:80'
networks:
- docker-network
volumes:
- data_wordpress:/var/www/html
wordpress:
container_name: wordpress
@ -46,7 +50,6 @@ services:
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=42wordpress42
- MYSQL_ROOT_PASSWORD=42root42
- DB_HOST=mariadb
- DB_PORT=3306

View File

@ -4,3 +4,6 @@ RUN apk add --no-cache \
nginx &&\
rm -rf /var/cache/apk/*
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,10 +1,21 @@
server {
listen 80;
server_name ${DOMAIN_NAME};
root /var/www/html/wordpress;
user nginx;
worker_processes 1;
access_log /var/log/nginx/example.${DOMAIN_NAME}-access.log;
error_log /var/log/nginx/example.${DOMAIN_NAME}-error.log error;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
root /var/www/html;
access_log /var/log/nginx/example.localhost-access.log;
error_log /var/log/nginx/example.localhost-error.log error;
index index.html index.htm index.php;
location / {
@ -17,4 +28,6 @@ server {
fastcgi_index index.php;
include fastcgi.conf;
}
}
}

View File

@ -29,6 +29,8 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
chmod +x wp-cli.phar && \
mv wp-cli.phar /usr/local/bin/wp
COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf
RUN echo "memory_limit = 512M" >> /etc/php83/php.ini
# Copy and set permissions for the install script

View File

@ -0,0 +1,10 @@
[www]
listen = 0.0.0.0:9000
user = wordpress
group = wordpress
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
catch_workers_output = yes

View File

@ -7,13 +7,19 @@ echo "Installing WordPress..."
sleep 10
# Check if the database exists
echo "wp core download --allow-root --path=/var/www/html"
wp core download --allow-root --path=/var/www/html
echo "wp config create --allow-root"
wp config create --allow-root \
--dbname=$MYSQL_DATABASE \
--dbuser=$MYSQL_USER \
--dbpass=$MYSQL_PASSWORD \
--dbhost=$DB_HOST \
--path=/var/www/html
echo "wp core install --allow-root"
wp core install --allow-root \
--url=$DOMAIN_NAME \
--title=$WP_TITLE \
@ -21,12 +27,16 @@ wp core install --allow-root \
--admin_password=$WP_ADMIN_PASSWORD \
--admin_email=$WP_ADMIN_EMAIL \
--path=/var/www/html
echo "wp user create --allow-root"
wp user create --allow-root \
$WP_USER \
$WP_USER_EMAIL \
--role=author \
--user_pass=$WP_USER_PASSWORD \
--path=/var/www/html
echo "wp theme install --allow-root"
wp theme install --allow-root \
$WP_THEME \
--activate \