init ninedocker
This commit is contained in:
67
misc/images/wordpress/containers/volume/entrypoint.sh
Executable file
67
misc/images/wordpress/containers/volume/entrypoint.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
cd /app/public
|
||||
|
||||
|
||||
if [[ ! -f /app/public/wp-config.php ]]
|
||||
then
|
||||
wp config create \
|
||||
--allow-root \
|
||||
--dbhost="${WORDPRESS_DB_HOST}" \
|
||||
--dbname="${WORDPRESS_DB_NAME}" \
|
||||
--dbuser="${WORDPRESS_DB_USER}" \
|
||||
--dbpass="${WORDPRESS_DB_PASSWORD}" \
|
||||
--dbcharset="utf8mb4" \
|
||||
--locale="fr_FR"
|
||||
fi
|
||||
|
||||
wp core multisite-install \
|
||||
--allow-root \
|
||||
--url="${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}" \
|
||||
--title="${WORDPRESS_TITLE}" \
|
||||
--admin_user="${WORDPRESS_USER}" \
|
||||
--admin_password="${WORDPRESS_PASSWORD}" \
|
||||
--admin_email="${WORDPRESS_EMAIL}" \
|
||||
--skip-email
|
||||
|
||||
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
|
||||
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
|
||||
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
|
||||
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
|
||||
|
||||
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
||||
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
||||
|
||||
wp config set --allow-root WP_ALLOW_MULTISITE true
|
||||
wp config set --allow-root MULTISITE true
|
||||
wp config set --allow-root SUBDOMAIN_INSTALL false
|
||||
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
|
||||
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
|
||||
wp config set --allow-root FORCE_ADMIN_SSL false
|
||||
wp config set --allow-root SITE_ID_CURRENT_SITE 1
|
||||
wp config set --allow-root BLOG_ID_CURRENT_SITE 1
|
||||
|
||||
# On fait croire à WP qu'il est en https
|
||||
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then
|
||||
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
||||
then
|
||||
echo "FORCE HTTPS already set"
|
||||
fi
|
||||
else
|
||||
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
||||
then
|
||||
echo "FORCE HTTPS set"
|
||||
head -n 1 "wp-config.php" > "wp-config.tmp"
|
||||
echo "\$_SERVER['HTTPS']='on';" >> "wp-config.tmp"
|
||||
tail -n +2 "wp-config.php" >> "wp-config.tmp"
|
||||
mv "wp-config.tmp" "wp-config.php"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Mise à jour theme / plugin / network
|
||||
wp theme update --allow-root --all
|
||||
wp plugin update --allow-root --all
|
||||
wp core update-db --network
|
||||
|
||||
exec $@
|
25
misc/images/wordpress/containers/wordpress/Dockerfile
Executable file
25
misc/images/wordpress/containers/wordpress/Dockerfile
Executable file
@ -0,0 +1,25 @@
|
||||
FROM reg.cadoles.com/envole/nineapache:8.1
|
||||
|
||||
# Paquet necessaire pour wordpress
|
||||
RUN apk add php81-mysqli
|
||||
|
||||
# Installation de wp-cli
|
||||
COPY wp-cli.phar /usr/local/bin/wp
|
||||
RUN chmod +x /usr/local/bin/wp
|
||||
|
||||
# Configuration apache
|
||||
RUN cd /app/public
|
||||
COPY apache.conf /etc/apache2/conf.d/zapp.conf
|
||||
|
||||
# Installation des sources wordpress
|
||||
RUN wp core download --path=/app/public --locale=fr_FR
|
||||
RUN chown -R apache:apache /app/public
|
||||
RUN find /app/public -type d -exec chmod 755 {} +
|
||||
RUN find /app/public -type f -exec chmod 644 {} +
|
||||
|
||||
RUN mkdir /docker
|
||||
COPY entrypoint.sh /docker/entrypoint.sh
|
||||
RUN chmod +x /docker/entrypoint.sh
|
||||
|
||||
# CMD
|
||||
CMD /docker/entrypoint.sh && /etc/apache2/apache2.sh
|
24
misc/images/wordpress/containers/wordpress/apache.conf
Normal file
24
misc/images/wordpress/containers/wordpress/apache.conf
Normal file
@ -0,0 +1,24 @@
|
||||
LoadModule rewrite_module modules/mod_rewrite.so
|
||||
ServerName nineapache.local
|
||||
DocumentRoot "/app/public"
|
||||
Alias /wordpress /app/public
|
||||
<Directory "/app/public">
|
||||
Options FollowSymLinks
|
||||
AllowOverride Limit Options FileInfo
|
||||
DirectoryIndex index.php
|
||||
Require all granted
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /wordpress/
|
||||
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
|
||||
# add a trailing slash to /wp-admin
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
|
||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^ - [L]
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
||||
RewriteRule . index.php [L]
|
||||
</Directory>
|
89
misc/images/wordpress/containers/wordpress/entrypoint.sh
Executable file
89
misc/images/wordpress/containers/wordpress/entrypoint.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
cd /app/public
|
||||
|
||||
|
||||
if [[ ! -f /app/public/wp-config.php ]]
|
||||
then
|
||||
wp config create \
|
||||
--allow-root \
|
||||
--dbhost="${WORDPRESS_DB_HOST}" \
|
||||
--dbname="${WORDPRESS_DB_NAME}" \
|
||||
--dbuser="${WORDPRESS_DB_USER}" \
|
||||
--dbpass="${WORDPRESS_DB_PASSWORD}" \
|
||||
--dbcharset="utf8mb4" \
|
||||
--locale="fr_FR"
|
||||
fi
|
||||
|
||||
|
||||
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
|
||||
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
|
||||
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
|
||||
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
|
||||
|
||||
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
||||
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
||||
|
||||
wp config set --allow-root WP_ALLOW_MULTISITE true
|
||||
wp config set --allow-root MULTISITE true
|
||||
wp config set --allow-root SUBDOMAIN_INSTALL false
|
||||
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
|
||||
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
|
||||
wp config set --allow-root FORCE_ADMIN_SSL false
|
||||
wp config set --allow-root SITE_ID_CURRENT_SITE 1
|
||||
wp config set --allow-root BLOG_ID_CURRENT_SITE 1
|
||||
|
||||
# On fait croire à WP qu'il est en https
|
||||
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then
|
||||
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
||||
then
|
||||
echo "FORCE HTTPS already set"
|
||||
fi
|
||||
else
|
||||
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
||||
then
|
||||
echo "FORCE HTTPS set"
|
||||
head -n 1 "wp-config.php" > "wp-config.tmp"
|
||||
echo "\$_SERVER['HTTPS']='on';" >> "wp-config.tmp"
|
||||
tail -n +2 "wp-config.php" >> "wp-config.tmp"
|
||||
mv "wp-config.tmp" "wp-config.php"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install multisite
|
||||
wp core multisite-install \
|
||||
--allow-root \
|
||||
--url="${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}" \
|
||||
--title="${WORDPRESS_TITLE}" \
|
||||
--admin_user="${WORDPRESS_USER}" \
|
||||
--admin_password="${WORDPRESS_PASSWORD}" \
|
||||
--admin_email="${WORDPRESS_EMAIL}" \
|
||||
--skip-email
|
||||
|
||||
# Switch language
|
||||
echo "== Switch languange"
|
||||
wp language core install fr_FR
|
||||
wp site switch-language fr_FR
|
||||
|
||||
# Install plugin
|
||||
#if [[ "${MODE_AUTH}" == "CAS" && "${CAS_ACTIVATE}" == "1" ]]
|
||||
#then
|
||||
# wp plugin install wp-cassify
|
||||
# wp plugin activate wp-cassify --network
|
||||
#else
|
||||
# wp plugin delete wp-cassify
|
||||
#fi
|
||||
|
||||
# Mise à jour theme / plugin / network
|
||||
wp theme install twentytwentyfour --allow-root
|
||||
wp theme update --allow-root --all
|
||||
wp plugin update --allow-root --all
|
||||
wp language core update
|
||||
wp language theme update --all
|
||||
wp language plugin update --all
|
||||
|
||||
# Mise à jour du network
|
||||
wp core update-db --network
|
||||
|
||||
exec $@
|
BIN
misc/images/wordpress/containers/wordpress/wp-cli.phar
Normal file
BIN
misc/images/wordpress/containers/wordpress/wp-cli.phar
Normal file
Binary file not shown.
Reference in New Issue
Block a user