「🏗️」 wip: wordpress nearly working need to fix title set and admin name and pass
This commit is contained in:
@ -11,7 +11,7 @@ COPY go.mod /build/go.mod
|
||||
COPY cmd /build/cmd
|
||||
COPY internal /build/internal
|
||||
COPY docker/wordpress/www-docker.conf /www-docker.conf
|
||||
COPY docker/wordpress/wp-config-docker.php /usr/src/wordpress/wp-config-docker.php
|
||||
COPY docker/wordpress/wp-config-docker.php /var/www/wordpress/wp-config-docker.php
|
||||
|
||||
RUN apk add --no-cache go curl php84-mysqli php84-fpm tzdata fcgi \
|
||||
&& cd /build \
|
||||
@ -22,9 +22,9 @@ RUN apk add --no-cache go curl php84-mysqli php84-fpm tzdata fcgi \
|
||||
&& rm -Rf /build \
|
||||
&& mkdir -p /usr/src/wordpress
|
||||
|
||||
VOLUME /usr/src/wordpress
|
||||
VOLUME /var/www/wordpress
|
||||
|
||||
WORKDIR /usr/src
|
||||
WORKDIR /var/www
|
||||
|
||||
RUN version='6.7.1' \
|
||||
&& curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz" \
|
||||
@ -32,17 +32,17 @@ RUN version='6.7.1' \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& tar -xzvf wordpress.tar.gz \
|
||||
&& rm wordpress.tar.gz \
|
||||
&& chown -R www-data:www-data /usr/src/wordpress \
|
||||
&& chown -R www-data:www-data /var/www/wordpress \
|
||||
&& mkdir wp-content \
|
||||
&& for dir in /usr/src/wordpress/wp-content/*/ cache; do \
|
||||
&& for dir in /var/www/wp-content/*/ cache; do \
|
||||
dir="$(basename "${dir%/}")"; \
|
||||
mkdir "wp-content/$dir"; \
|
||||
done \
|
||||
&& chown -R www-data:www-data wp-content \
|
||||
&& chmod -R 1777 wp-content
|
||||
&& chown -R www-data:www-data /var/www/wordpress/wp-content \
|
||||
&& chmod -R 1777 /var/www/wordpress/wp-content
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint" ]
|
||||
WORKDIR /usr/src/wordpress
|
||||
WORKDIR /var/www/wordpress
|
||||
STOPSIGNAL SIGQUIT
|
||||
|
||||
EXPOSE 9000
|
||||
|
@ -64,6 +64,13 @@ define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
|
||||
/** The database collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
|
||||
|
||||
/** Site url, user and pass */
|
||||
define( 'WP_ADMIN_USER', getenv_docker('WORDPRESS_ADMIN_USER', 'admin'));
|
||||
define( 'WP_ADMIN_PASS', getenv_docker('WORDPRESS_ADMIN_PASS', 'password123'));
|
||||
define( 'WP_ADMIN_EMAIL', getenv_docker('WORDPRESS_ADMIN_EMAIL', 'admin@example.com'));
|
||||
define( 'WP_SITE_TITLE', getenv_docker('WORDPRESS_SITE_TITLE', 'My WordPress Site'));
|
||||
define( 'WP_SEARCH_ENGINE_VISIBILITY', getenv_docker('WORDPRESS_SEARCH_ENGINE_VISIBILITY', false));
|
||||
|
||||
/**#@+
|
||||
* Authentication unique keys and salts.
|
||||
*
|
||||
@ -137,3 +144,31 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once ABSPATH . 'wp-settings.php';
|
||||
|
||||
/**
|
||||
* Custom script to set up admin user
|
||||
*/
|
||||
function setup_admin_user() {
|
||||
global $wpdb;
|
||||
|
||||
$user = WP_ADMIN_USER;
|
||||
$pass = WP_ADMIN_PASS;
|
||||
$email = WP_ADMIN_EMAIL;
|
||||
|
||||
if ( ! username_exists( $user ) && ! email_exists( $email ) ) {
|
||||
$user_id = wp_create_user( $user, $pass, $email );
|
||||
$user = new WP_User( $user_id );
|
||||
$user->set_role( 'administrator' );
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'setup_admin_user' );
|
||||
|
||||
/**
|
||||
* Custom script to set up search engine visibility
|
||||
*/
|
||||
function setup_search_engine_visibility() {
|
||||
if ( get_option( 'blog_public' ) === '1' ) {
|
||||
update_option( 'blog_public', !WP_SEARCH_ENGINE_VISIBILITY );
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'setup_search_engine_visibility' );
|
||||
|
Reference in New Issue
Block a user