Sign inSign up

oanhnn/php-stack

By oanhnn

Updated almost 8 years ago

An image with stack for developer working with PHP application (Eg: Laravel, Symfony, ...)

Image
0

3.5K

oanhnn/php-stack repository overview

oanhnn/docker-php-stack

Build Status

Repository of oanhnn/php-stack Docker image.

Features

  • Base from alpine:3.7 image
  • Install supervisor
  • Install php-fpm 7.1
  • Install nginx
  • Install curl

Requirement

  • Docker Engine 1.13+

Usage

Example for a Laravel application

  1. Make Dockerfile
# Dockerfile
FROM oanhnn/php-stack:latest

RUN echo ">>> Install nodejs, npm, yarn and laravel-echo-server" \
 && apk add --update \
    nodejs \
    nodejs-npm yarn \
 && apk add --update --no-cache -t .build-deps python make g++ gcc \
 && yarn global add --prod --no-lockfile laravel-echo-server \
 && apk del .build-deps \
 && yarn cache clean \
 && rm -rf /tmp/* /var/cache/apk/* \
 && echo ">>> Setting crond for laravel scheduler" \
 && echo -e "*\t*\t*\t*\t*\tphp /path/to/artisan schedule:run > /dev/null 2>&1" | crontab -u www-data -

COPY laravel-echo.ini /etc/supervisor.d/laravel-echo.ini
COPY laravel-horizon.ini /etc/supervisor.d/laravel-horizon.ini
#COPY laravel-workers.ini /etc/supervisor.d/laravel-workers.ini
  1. Make some supervisor's program config files
;; laravel-echo.ini
;; https://github.com/tlaverdure/laravel-echo-server
[program:laravel-echo]
process_name=%(program_name)s
directory=/app
command=/usr/local/bin/laravel-echo-server start
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/supervisord/laravel-echo.log
;; laravel-horizon.ini
;; https://laravel.com/docs/5.5/horizon
[program:laravel-horizon]
process_name=%(program_name)s
directory=/app
command=php artisan horizon
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/supervisord/laravel-horizon.log

laravel-wokers.ini only use when your application dosen't install Laravel Horizon

;; laravel-workers.ini
;; https://laravel.com/docs/5.5/queues#supervisor-configuration
[program:laravel-worker]
process_name=worker_%(process_num)02d
directory=/app
command=php artisan queue:work redis --sleep=3 --tries=3 --queue=events,notifications,default
autostart=true
autorestart=true
user=www-data
numprocs=5
redirect_stderr=true
stdout_logfile=/var/log/supervisord/laravel-worker.log
  1. Build and run

Contributing

All code contributions must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send a pull request.

If you would like to help take a look at the list of issues.

License

This project is released under the MIT License.
Copyright © 2017 Oanh Nguyen
Please see License File for more information.

Tag summary

Content type

Image

Digest

Size

63.4 MB

Last updated

almost 8 years ago

docker pull oanhnn/php-stack