-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
243 lines (219 loc) · 8.36 KB
/
Copy pathDockerfile.dev
File metadata and controls
243 lines (219 loc) · 8.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# ============================================================================
# Aevov Development Dockerfile
# ============================================================================
# PHP 8.2 with WordPress, WP-CLI, Composer, and all required extensions
# Optimized for Aevov plugin development and testing
# ============================================================================
FROM wordpress:latest
LABEL maintainer="Aevov Development Team"
LABEL description="WordPress development environment for Aevov ecosystem"
# Set working directory
WORKDIR /var/www/html
# ============================================================================
# Install System Dependencies
# ============================================================================
RUN apt-get update && apt-get install -y \
# Build tools
build-essential \
git \
curl \
wget \
unzip \
vim \
nano \
\
# PHP extensions dependencies
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libonig-dev \
libxml2-dev \
libicu-dev \
libssl-dev \
\
# Image processing
imagemagick \
libmagickwand-dev \
\
# Database clients
default-mysql-client \
\
# Redis client
redis-tools \
\
# Other utilities
less \
htop \
procps \
net-tools \
iputils-ping \
\
&& rm -rf /var/lib/apt/lists/*
# ============================================================================
# Install PHP Extensions
# ============================================================================
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
&& docker-php-ext-install -j$(nproc) \
gd \
mysqli \
pdo \
pdo_mysql \
zip \
intl \
exif \
bcmath \
opcache \
soap \
sockets
# Install Redis extension
RUN pecl install redis-5.3.7 \
&& docker-php-ext-enable redis
# Install Imagick extension
RUN pecl install imagick \
&& docker-php-ext-enable imagick
# Install Xdebug for development (optional, can be enabled via env var)
RUN pecl install xdebug-3.2.2 \
&& docker-php-ext-enable xdebug
# ============================================================================
# Install Composer
# ============================================================================
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer \
--version=2.6.5
# ============================================================================
# Install WP-CLI
# ============================================================================
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp
# ============================================================================
# Install Node.js and npm (for asset building)
# ============================================================================
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
# ============================================================================
# PHP Configuration for Development
# ============================================================================
RUN { \
echo 'memory_limit = 512M'; \
echo 'upload_max_filesize = 64M'; \
echo 'post_max_size = 64M'; \
echo 'max_execution_time = 300'; \
echo 'max_input_time = 300'; \
echo 'display_errors = On'; \
echo 'error_reporting = E_ALL'; \
echo 'log_errors = On'; \
echo 'error_log = /var/log/php_errors.log'; \
echo 'date.timezone = UTC'; \
\
# Xdebug configuration (disabled by default, enable via env var)
echo 'xdebug.mode = off'; \
echo 'xdebug.start_with_request = yes'; \
echo 'xdebug.client_host = host.docker.internal'; \
echo 'xdebug.client_port = 9003'; \
echo 'xdebug.log = /tmp/xdebug.log'; \
\
# OPcache configuration
echo 'opcache.enable = 1'; \
echo 'opcache.memory_consumption = 128'; \
echo 'opcache.interned_strings_buffer = 8'; \
echo 'opcache.max_accelerated_files = 10000'; \
echo 'opcache.revalidate_freq = 0'; \
echo 'opcache.validate_timestamps = 1'; \
} > /usr/local/etc/php/conf.d/custom.ini
# ============================================================================
# Apache Configuration
# ============================================================================
RUN a2enmod rewrite expires headers ssl
# Custom Apache configuration
RUN { \
echo '<Directory /var/www/html>'; \
echo ' Options Indexes FollowSymLinks'; \
echo ' AllowOverride All'; \
echo ' Require all granted'; \
echo '</Directory>'; \
} > /etc/apache2/conf-available/wordpress.conf \
&& a2enconf wordpress
# ============================================================================
# Create Required Directories
# ============================================================================
RUN mkdir -p \
/var/www/html/wp-content/plugins \
/var/www/html/wp-content/uploads \
/var/www/html/wp-content/testing \
/var/log \
&& chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# ============================================================================
# Install WordPress Testing Framework
# ============================================================================
RUN mkdir -p /tmp/wordpress-tests-lib \
&& cd /tmp/wordpress-tests-lib \
&& svn co --quiet https://develop.svn.wordpress.org/tags/6.4/tests/phpunit/includes/ includes \
&& svn co --quiet https://develop.svn.wordpress.org/tags/6.4/tests/phpunit/data/ data \
&& wget -q https://develop.svn.wordpress.org/tags/6.4/wp-tests-config-sample.php -O wp-tests-config.php
# ============================================================================
# Add Custom Scripts
# ============================================================================
# Script to activate all Aevov plugins
RUN { \
echo '#!/bin/bash'; \
echo 'echo "Activating all Aevov plugins..."'; \
echo 'cd /var/www/html'; \
echo 'for plugin_dir in wp-content/plugins/aevov-*; do'; \
echo ' plugin=$(basename "$plugin_dir")'; \
echo ' wp plugin activate "$plugin" --allow-root 2>/dev/null && echo "✓ Activated: $plugin" || echo "✗ Failed: $plugin"'; \
echo 'done'; \
echo 'wp plugin activate aps-tools bloom-chunk-scanner bloom-pattern-recognition AevovPatternSyncProtocol --allow-root 2>/dev/null'; \
echo 'echo "Done!"'; \
} > /usr/local/bin/activate-aevov-plugins \
&& chmod +x /usr/local/bin/activate-aevov-plugins
# Script to run Aevov tests
RUN { \
echo '#!/bin/bash'; \
echo 'echo "Running Aevov workflow tests..."'; \
echo 'php /var/www/html/wp-content/testing/workflow-test-runner.php "$@"'; \
} > /usr/local/bin/aevov-test \
&& chmod +x /usr/local/bin/aevov-test
# Script to setup WordPress
RUN { \
echo '#!/bin/bash'; \
echo 'set -e'; \
echo 'if ! wp core is-installed --allow-root 2>/dev/null; then'; \
echo ' echo "Installing WordPress..."'; \
echo ' wp core install \'; \
echo ' --url="http://localhost:8080" \'; \
echo ' --title="Aevov Development Site" \'; \
echo ' --admin_user="admin" \'; \
echo ' --admin_password="admin" \'; \
echo ' --admin_email="admin@aevov.local" \'; \
echo ' --skip-email \'; \
echo ' --allow-root'; \
echo ' echo "WordPress installed successfully!"'; \
echo ' activate-aevov-plugins'; \
echo 'else'; \
echo ' echo "WordPress already installed."'; \
echo 'fi'; \
} > /usr/local/bin/setup-wordpress \
&& chmod +x /usr/local/bin/setup-wordpress
# ============================================================================
# Healthcheck
# ============================================================================
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost/ || exit 1
# ============================================================================
# Entrypoint
# ============================================================================
COPY docker/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh || true
# Expose port
EXPOSE 80
# Start Apache
CMD ["apache2-foreground"]