Skip to content

Commit

Permalink
Test: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
curious-mike-dvc committed Jul 20, 2024
1 parent 632ed18 commit 7085aa0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
31 changes: 21 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,35 @@ FROM php:8.1.28-fpm-alpine3.18 AS base
RUN apk update && apk add --no-cache \
nginx \
supervisor \
bash
bash \
nano

# Create necessary directories and set permissions
RUN mkdir -p /var/run/nginx && \
mkdir -p /var/log/nginx && \
mkdir -p /var/log/supervisor && \
chown -R www-data:www-data /var/run/nginx && \
chown -R www-data:www-data /var/log/nginx && \
chown -R www-data:www-data /var/log/supervisor && \
chown -R www-data:www-data /etc/nginx && \
chown -R www-data:www-data /usr/sbin/nginx && \
chown -R www-data:www-data /usr/local/sbin/php-fpm
RUN mkdir -p /var/run/nginx \
&& mkdir -p /var/run/php-fpm \
&& mkdir -p /var/log/nginx \
&& mkdir -p /var/log/supervisor \
&& mkdir -p /var/log/php-fpm \
&& chown -R www-data:www-data /var/run/nginx \
&& chown -R www-data:www-data /var/run/php-fpm \
&& chown -R www-data:www-data /var/log/nginx \
&& chown -R www-data:www-data /var/log/supervisor \
&& chown -R www-data:www-data /var/log/php-fpm \
&& chown -R www-data:www-data /etc/nginx \
&& chown -R www-data:www-data /usr/sbin/nginx \
&& chown -R www-data:www-data /usr/local/sbin/php-fpm \
&& chown -R www-data:www-data /usr/local/etc/php-fpm.conf \
&& touch /var/log/php-fpm/php-fpm.log \
&& chown www-data:www-data /var/log/php-fpm/php-fpm.log

# Copy Nginx and Supervisor configuration files
COPY ./config/nginx.conf /etc/nginx/nginx.conf
COPY ./config/nginx-default.conf /etc/nginx/conf.d/default.conf
COPY ./config/supervisord.conf /etc/supervisord.conf

# Copy custom PHP-FPM configuration
COPY ./config/php-fpm.conf /usr/local/etc/php-fpm.conf

# Copy PHP configuration
COPY ./config/php.ini /usr/local/etc/php/php.ini

Expand Down
18 changes: 10 additions & 8 deletions config/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[global]
pid = /var/run/php-fpm/php-fpm.pid
error_log = /var/log/php-fpm/php-fpm.log
log_level = debug
include=/usr/local/etc/php-fpm.d/*.conf

[www]
user = www-data
group = www-data

listen = 127.0.0.1:9000

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

chdir = /
pm.max_children = 10
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
4 changes: 3 additions & 1 deletion config/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ logfile=/var/log/supervisor/supervisord.log
loglevel=info

[program:php-fpm]
command=/usr/local/sbin/php-fpm
command=/usr/local/sbin/php-fpm --fpm-config /usr/local/etc/php-fpm.conf
directory=/usr/local
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/php-fpm.err.log
stdout_logfile=/var/log/supervisor/php-fpm.out.log
user=www-data

[program:nginx]
command=/usr/sbin/nginx -c /etc/nginx/nginx.conf -g 'daemon off;'
Expand Down

0 comments on commit 7085aa0

Please sign in to comment.