-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
106 lines (89 loc) · 3.23 KB
/
Dockerfile.dev
File metadata and controls
106 lines (89 loc) · 3.23 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
# Development Dockerfile - PHP-FPM + Nginx (Debian-based for easier dev tooling)
FROM php:8.3-fpm-bookworm
# Install Nginx, Supervisor, and development dependencies
RUN apt-get update && apt-get install -y \
# Nginx and Supervisor
nginx \
supervisor \
# PostgreSQL client and dev libraries
libpq-dev \
postgresql-client \
# Image processing (GD extension)
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
# ZIP support
libzip-dev \
# Development tools (make it easy for devs to tinker)
git \
unzip \
curl \
wget \
vim \
nano \
htop \
net-tools \
iputils-ping \
procps \
telnet \
dnsutils \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
pdo \
pdo_pgsql \
pgsql \
zip
# Install Redis extension (optional - uncomment if needed)
# RUN pecl install redis \
# && docker-php-ext-enable redis
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer --version
# Configure PHP for development (verbose errors, debugging enabled)
RUN { \
echo 'display_errors=On'; \
echo 'error_reporting=E_ALL'; \
echo 'log_errors=On'; \
echo 'error_log=/var/log/php_errors.log'; \
echo 'max_execution_time=60'; \
echo 'memory_limit=512M'; \
echo 'post_max_size=50M'; \
echo 'upload_max_filesize=50M'; \
} > /usr/local/etc/php/conf.d/development.ini
# Configure PHP-FPM (relaxed limits for development)
RUN echo "pm = dynamic" > /usr/local/etc/php-fpm.d/zz-custom.conf \
&& echo "pm.max_children = 20" >> /usr/local/etc/php-fpm.d/zz-custom.conf \
&& echo "pm.start_servers = 2" >> /usr/local/etc/php-fpm.d/zz-custom.conf \
&& echo "pm.min_spare_servers = 1" >> /usr/local/etc/php-fpm.d/zz-custom.conf \
&& echo "pm.max_spare_servers = 10" >> /usr/local/etc/php-fpm.d/zz-custom.conf
# Set working directory
WORKDIR /app
# Copy Nginx configuration
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/default.conf /etc/nginx/sites-available/default
# Create nginx sites-enabled symlink
RUN rm -f /etc/nginx/sites-enabled/default \
&& ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# Copy Supervisor configuration
COPY docker/supervisord-dev.conf /etc/supervisor/conf.d/supervisord.conf
# Copy composer files first (better layer caching)
COPY composer.json composer.lock ./
# Install dependencies (development mode with dev packages)
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install --no-interaction --optimize-autoloader
# Copy application code
COPY . .
# Create required directories with proper permissions
RUN mkdir -p /var/log/stonescriptphp \
&& chown -R www-data:www-data /var/log/stonescriptphp \
&& chmod -R 755 /var/log/stonescriptphp
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Start Supervisor (manages Nginx + PHP-FPM)
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]