GithubHelp home page GithubHelp logo

roquie / heroku-like-docker-php Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 451 KB

This container optimized for fast starting and using with PaaS like as: Heroku, Flynn, Deis Workflow and many others. And for many popular PHP frameworks.

License: MIT License

Shell 64.25% Makefile 8.10% HTML 0.24% Dockerfile 27.41%
laravel flynn heroku deis-workflow php-fpm docker paas nginx php

heroku-like-docker-php's Introduction

Docker-image DEPRECATED, please use the best replacement for it: https://github.com/roquie/docker-php-webapp


Heroku like Docker PHP container

These are docker images for PHP running on a Nginx container. This container optimized for fast starting and using with PaaS like as: Heroku, Flynn, Deis Workflow and many others. And for many popular PHP frameworks.

PHP-FPM

By default this container to disable clear_env option of php-fpm inside a config for pools. This needed for reading environment variables passed by PasS service (like as flynn) before starting the php-fpm process.
So, if you're want to return behavior to default settings, you can be set up that env variable.

For example like this:

ENV PHP_FPM_CLEAR_ENV yes

Example for Laravel

FROM roquie/heroku-like-docker-php:latest

COPY --chown=nginx:nginx . /srv/www

ENV NGINX_WEBROOT /srv/www/public

Example enabling cronjob for Laravel tasks

FROM roquie/heroku-like-docker-php:latest

COPY --chown=nginx:nginx . /srv/www

ENV CRON_ENABLED true
RUN echo -e "* * * * * php /srv/www/artisan schedule:run >> /dev/null 2>&1\[email protected]" >> /etc/crontabs/root

Principles

Container should be just fast upped and fast runned, without pre-provisioning.

  • Any dependencies, like as composer, npm/yarn, bower or %PACKAGE_MANAGER% should be installed outside of container.
  • Any long-operations must be used inside a Dockerfile

Upgrade from previous version

  • Change CADDY_WEBROOT env variable to NGINX_WEBROOT.
  • Use RUN chown -R nginx:nginx /srv/www.
  • Done.

Volumes

  • /srv/www
  • /etc/php7/custom.d

Ports

  • 8080

Available environment variables

ENV PHP_MEMORY_LIMIT 512M
ENV PHP_POST_MAX_SIZE 2G
ENV PHP_UPLOAD_MAX_FILESIZE 2G
ENV PHP_MAX_EXECUTION_TIME 3600
ENV PHP_MAX_INPUT_TIME 3600
ENV PHP_DATE_TIMEZONE UTC
ENV PHP_LOG_LEVEL warning
ENV PHP_MAX_CHILDREN 75
ENV PHP_MAX_REQUESTS 500
ENV PHP_PROCESS_IDLE_TIMEOUT 10s
ENV PHP_FPM_CLEAR_ENV no
ENV PHP_INI_EXPOSE Off
ENV CONFIGURE_CUSTOM false
ENV CRON_ENABLED false
ENV PHP_RUN_USER nginx
ENV PHP_RUN_GROUP nginx
ENV PHP_OPCACHE_ENABLED 1

Inherited environment variables

How to works with MongoDB?

You can be built extension from source:

FROM roquie/heroku-like-docker-php:latest

ENV PHP_EXT_BUILD_DEPS \
    autoconf \
    dpkg-dev dpkg \
    file \
    g++ \
    gcc \
    libc-dev \
    make \
    pcre-dev \
    pkgconf \
    re2c \
    php7-dev \
    coreutils \
    curl-dev \
    libedit-dev \
    libxml2-dev \
    openssl-dev

RUN apk add --no-cache $PHP_EXT_BUILD_DEPS && \
    pecl install mongodb && \
    echo "extension=mongodb.so" > /etc/php7/conf.d/03_mongodb.ini && \
    chmod 755 /usr/lib/php7/modules/mongodb.so && \
    pecl clear-cache
    # apk del $PHP_EXT_BUILD_DEPS

ENV NGINX_WEBROOT /srv/www/public

Versions

  • latest

Authors

License

MIT

heroku-like-docker-php's People

Contributors

roquie avatar smgladkovskiy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

heroku-like-docker-php's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.