Public Repository

Last pushed: 23 days ago
Short Description
PHP-FPM Alpine based Oberon configured application containers
Full Description

[2017-11-20] Updated nodejs, PHP56, PHP70 and PHP71

Updated nodejs (8.9.1), yarn (1.3.2), bower (1.8.2), gulp (3.9.1) and pm2 (2.7.2) for all packages
Updated PHP56 to 5.6.32
Updated PHP70 to 7.0.25
Updated PHP71 to 7.1.11

[2017-10-20] Recommended for crontabs

Create a start.sh and run it using "entrypoint" in docker-compose and add this lines to the start.sh:

env | sed -r "s/'/\\\'/gm" | sed -r "s/^([^=]+=)(.*)\$/export \1'\2'/gm" > /root/project_env.sh
chmod a+x /root/project_env.sh
crontab docker/crontab
service cron start

And start PHP-FPM/supervisor at the end of the start.sh

[2017-10-12] Updated nodejs, PHP70 and PHP71

Updated nodejs, yarn, bower, gulp and pm2 for all packages
Updated PHP70 to 7.0.24
Updated PHP71 to 7.1.10

[2017-09-20] Updated nodejs, PHP70 and PHP71

Updated nodejs, yarn, bower, gulp and pm2 for all packages
Updated PHP70 to 7.0.23
Updated PHP71 to 7.1.9

[2017-07-19] Getting crontabs to work on Docker is a real pain in the *ss...

Add this to your deployment script, this will write all environment vars to file so the cronjobs can access them (for example PHP needs the vars for configuration):

printenv | sed 's/^\(.*\)$/export \1/g' > /root/project_env.sh

Your crontab should look something like this:

SHELL=/bin/bash
* * * * * . /root/project_env.sh; /usr/local/bin/php /app/MYFILE.php 2>&1
# Leave last line empty for cron

Solution found here:
https://ypereirareis.github.io/blog/2016/02/29/docker-crontab-environment-variables/
https://devblog.digimondo.io/how-to-use-environment-variables-in-docker-with-cron-50b20baab430


Latest PHP 5.6, 7.0 and 7.1 FPM containers compiled with modules used by Oberon server setups:

Additional modules:

  • bcmath
  • exif
  • gd
  • intl
  • mcrypt
  • memcache (php56)
  • memcached
  • mysql (php56)
  • mysqli
  • OPcache
  • redis
  • soap
  • sockets
  • xml
  • xmlrpc
  • xsl
  • zip

Default settings:

date.timezone to "Europe/Amsterdam"
expose_php=off
realpath_cache_ttl=7200
opcache.memory_consumption=32
opcache.enable_cli=1
opcache.enable_file_override=1

Adjustable settings using environment variables:

PHP_MAX_EXECUTION_TIME
PHP_MEMORY_LIMIT
PHP_UPLOAD_LIMIT
PHP_OPCACHE_LIMIT
PHP_OPCACHE_REVALIDATE
PHP_SESSION_SAVE_HANDLER
PHP_SESSION_SAVE_PATH
PHP_SMTP_HOST

Example docker-compose.yml:
web:
    image: jiechin/apache:2.4-alpine-fpm
    volumes:
        - .:/app/
    environment:
        - "APACHE_DOCUMENTROOT=/app/web"
    links:
        - php
php:
    image: jiechin/php:7.1-fpm
    volumes:
        - .:/app/
    environment:
        - "PHP_SESSION_SAVE_HANDLER=redis"
        - "PHP_SESSION_SAVE_PATH=tcp://redis:6379"
    links:
        - redis
redis:
    image: redis:3-alpine

Redis:

Using link to redis container and set the sessionhandler to redis and savepath to redis port

Example docker-compose.yml:
php:
    environment:
        - "PHP_SESSION_SAVE_HANDLER=redis"
        - "PHP_SESSION_SAVE_PATH=tcp://redis:6379"
    links:
        - redis
redis:
    image: redis:3-alpine

Sendmail:

Using external_links to docker service, override the default SMTP host using PHP_SMTP_HOST env.

Example docker-compose.yml:
php:
    image: jiechin/php:7.1-fpm
    environment:
        - "PHP_SMTP_HOST=smtp_prod"
    external_links:
        - smtp_prod

Nodejs:

Added nodejs 8.1, npm 5
Preinstalled globally NPM packages: yarn, bower, gulp

[2017-07-19] Added cron and supervisord services

Both services are disabled by default.
To enable cronjobs:

crontab /app/YOUR_CRONFILE
service cron start

To enable supervisor:
Add entry to your volumes in docker-compose.yml:

volumes:
    - ./YOUR_SUPERVISOR.conf:/etc/supervisor/conf.d/PROJECT.conf:ro

And start the supervisord service:

service supervisor start
Docker Pull Command
Owner
jiechin