rash07/supervisor-php

By rash07

Updated over 1 year ago

Supervisor service for Laravel App, composer & php installed

Image
Languages & frameworks
Message queues
Web servers
0

1.8K

rash07/supervisor-php repository overview

Dockerfile

FROM php:8.2-fpm

RUN apt-get update && apt-get install -y \
    wget \
    curl \
    nano \
    supervisor

# Install PHP extensions
RUN curl -sSLf \
    -o /usr/local/bin/install-php-extensions \
    https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
    chmod +x /usr/local/bin/install-php-extensions

RUN install-php-extensions mbstring pdo_mysql exif pcntl bcmath gd intl soap curl xml

# install composer
RUN wget https://getcomposer.org/composer-stable.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer

# update parameters
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

RUN sed -i -e "s/^ *memory_limit.*/memory_limit = 4000M/g" -e "s/^ *max_execution_time.*/max_execution_time = 800/g" -e "s/^ *max_input_time.*/max_input_time = 800/g" -e "s/^ *;pcre.backtrack_limit.*/pcre.backtrack_limit = 5000000/g" /usr/local/etc/php/php.ini

# color bash
RUN echo PS1="'"'${debian_chroot:+($debian_chroot)}\ \033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '"'" >> /root/.bashrc

RUN echo alias ls="'"'ls --color=auto'"'" >> /root/.bashrc

WORKDIR /var/www/html

# Set the command to run Supervisor in the foreground
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]

docker-compose file example

version: '3'

services:
    php:
        image: rash07/supervisor-php:8.2
        volumes:
            - ./:/var/www/html
            - ./supervisor:/etc/supervisor/conf.d/ # multiple files
        restart: always
        privileged: true

supervisor.conf file example

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/supervisor.log
stopwaitsecs=3600

Tag summary

Content type

Image

Digest

sha256:dd829cfa1

Size

189.6 MB

Last updated

over 1 year ago

docker pull rash07/supervisor-php:8.3