feat: add WordPress as runtime — Dockerfile, K8s env vars, wp-content PVC, frontend UI
Backend: - Add WORDPRESS to AppRuntime enum - Add wordpressDockerfile() using wordpress:6-php8.3-apache base image with custom theme/plugin/wp-content merge support - Add WordPress-specific K8s env vars (WORDPRESS_DB_HOST, WORDPRESS_DB_USER, WORDPRESS_DB_PASSWORD, WORDPRESS_DB_NAME, WORDPRESS_TABLE_PREFIX) - Create wp-content PersistentVolumeClaim (2Gi) for WordPress deployments - Mount wp-content PVC in deployment container at /var/www/html/wp-content Frontend: - Add 'wordpress' to runtime type unions (Application, CreateApplicationDto) - Add WordPress runtime card in deploy page (port 80, blue icon) - Auto-select MySQL database when WordPress is chosen, disable other DB options - Show Persian hint 'وردپرس به MySQL نیاز دارد' when WordPress selected - Update all runtime icon colors across dashboard, apps, admin/apps pages to show blue-600 for WordPress
This commit is contained in:
@@ -288,6 +288,8 @@ export class BuildService {
|
||||
return this.nodeDockerfile(app);
|
||||
case AppRuntime.LARAVEL:
|
||||
return this.laravelDockerfile(app);
|
||||
case AppRuntime.WORDPRESS:
|
||||
return this.wordpressDockerfile(app);
|
||||
default:
|
||||
throw new Error(`Unsupported runtime: ${app.runtime}`);
|
||||
}
|
||||
@@ -384,6 +386,39 @@ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
`;
|
||||
}
|
||||
|
||||
private wordpressDockerfile(app: Application): string {
|
||||
return `FROM wordpress:6-php8.3-apache
|
||||
|
||||
# Install additional PHP extensions commonly needed by WordPress
|
||||
RUN docker-php-ext-install opcache
|
||||
|
||||
# Enable Apache mod_rewrite for pretty permalinks
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Copy user's custom themes, plugins, and uploads if provided
|
||||
COPY . /tmp/user-content
|
||||
|
||||
# Merge user content into the WordPress installation
|
||||
# - wp-content/themes, wp-content/plugins, wp-content/uploads
|
||||
# - Also support full WordPress roots (with wp-config.php, etc.)
|
||||
RUN if [ -d /tmp/user-content/wp-content ]; then \\
|
||||
cp -a /tmp/user-content/wp-content/. /var/www/html/wp-content/; \\
|
||||
fi && \\
|
||||
if [ -f /tmp/user-content/wp-config.php ]; then \\
|
||||
cp /tmp/user-content/wp-config.php /var/www/html/wp-config.php; \\
|
||||
fi && \\
|
||||
# Copy any loose PHP files (custom root files)
|
||||
find /tmp/user-content -maxdepth 1 -name "*.php" ! -name "wp-config.php" -exec cp {} /var/www/html/ \\\\; 2>/dev/null || true && \\
|
||||
rm -rf /tmp/user-content
|
||||
|
||||
# Set proper ownership
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["apache2-foreground"]
|
||||
`;
|
||||
}
|
||||
|
||||
private async waitForJobCompletion(
|
||||
batchApi: k8s.BatchV1Api,
|
||||
coreApi: k8s.CoreV1Api,
|
||||
|
||||
Reference in New Issue
Block a user