File tree Expand file tree Collapse file tree 3 files changed +35
-7
lines changed
Expand file tree Collapse file tree 3 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,9 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
1010 && chmod +x wp-cli.phar \
1111 && mv wp-cli.phar /usr/local/bin/wp
1212
13- # Copy the revalidation plugin
14- COPY next-revalidate /var/www/html/wp-content/plugins/next-revalidate
15-
16- # Copy the headless redirect theme
17- COPY theme /var/www/html/wp-content/themes/nextjs-headless
13+ # Copy plugin and theme to staging location (volume overwrites /var/www/html)
14+ COPY next-revalidate /usr/src/next-revalidate
15+ COPY theme /usr/src/nextjs-headless
1816
1917# Copy the setup scripts
2018COPY setup.sh /usr/local/bin/setup-wordpress.sh
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Run the setup script in the background after a delay
4- (sleep 30 && /usr/local/bin/setup-wordpress.sh) &
3+ # Copy plugin and theme from staging to WordPress (after volume is mounted)
4+ copy_custom_files () {
5+ # Wait for WordPress files to be ready
6+ while [ ! -d /var/www/html/wp-content/plugins ]; do
7+ sleep 2
8+ done
9+
10+ # Copy plugin if not already present
11+ if [ ! -d /var/www/html/wp-content/plugins/next-revalidate ]; then
12+ echo " Installing next-revalidate plugin..."
13+ cp -r /usr/src/next-revalidate /var/www/html/wp-content/plugins/
14+ chown -R www-data:www-data /var/www/html/wp-content/plugins/next-revalidate
15+ fi
16+
17+ # Copy theme if not already present
18+ if [ ! -d /var/www/html/wp-content/themes/nextjs-headless ]; then
19+ echo " Installing nextjs-headless theme..."
20+ cp -r /usr/src/nextjs-headless /var/www/html/wp-content/themes/
21+ chown -R www-data:www-data /var/www/html/wp-content/themes/nextjs-headless
22+ fi
23+
24+ # Run the setup script
25+ /usr/local/bin/setup-wordpress.sh
26+ }
27+
28+ # Run copy and setup in background after a delay
29+ (sleep 10 && copy_custom_files) &
530
631# Run the original WordPress entrypoint
732exec docker-entrypoint.sh " $@ "
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ if ! wp core is-installed --allow-root 2>/dev/null; then
2121 --allow-root
2222
2323 echo " WordPress installed successfully!"
24+
25+ # Remove default plugins (keep only next-revalidate)
26+ echo " Removing default plugins..."
27+ wp plugin delete akismet --allow-root 2> /dev/null || true
28+ wp plugin delete hello --allow-root 2> /dev/null || true
2429fi
2530
2631# Activate the revalidation plugin if not already active
You can’t perform that action at this time.
0 commit comments