PHP code example of ronmi / dockerkit

1. Go to this page and download the library: Download ronmi/dockerkit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ronmi / dockerkit example snippets


$f = new Fruit\DockerKit\Dockerfile('debian:latest', 'John Doe <[email protected]>');

$f
    ->distro('debian')
    ->install(['php5-fpm', 'php5'])
    ->ensureBash()
    ->grouping(true)
    ->textfileArray([
        '#!/bin/bash',
        'service php5-fpm restart',
        'trap "echo Stopping fpm...;service php5-fpm stop" INT TERM',
        '(kill -STOP $BASHPID)&',
        'wait',
    ], '/start.sh')
    ->chmod('a+x', '/start.sh')
    ->grouping(false)
    ->entrypoint(['bash', '/start.sh']);

echo $f->generate();

(new Fruit\DockerKit\DockerBuild('my_tag')->run($f);

$f = new Fruit\DockerKit\Dockerfile('debian:latest', 'John Doe <[email protected]>');
$f->distro('debian')->install(['nginx', 'php5-fpm']);

(new Fruit\DockerKit\ServiceStarter('/entry.sh'))
    ->starters([
        'service php5-fpm start',
        'service nginx start',
    ])
    ->stopers([
        'service php5-fpm stop',
        'service nginx stop',
    ])
    ->installTo($f);

echo $f->entrypoint('/entry.sh')->generate();

FROM debian:latest
MAINTAINER John Doe <[email protected]>
RUN apt-get update \
 && apt-get install -y php5-fpm php5 \
 && apt-get clean \
 && echo 'dash dash/sh boolean false'|debconf-set-selections \
 && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash \
 && echo '#!/bin/bash'|tee /start.sh \
 && echo 'service php5-fpm restart'|tee -a /start.sh \
 && echo 'trap "echo Stopping fpm...;service php5-fpm stop" INT TERM'|tee -a /start.sh \
 && echo '(kill -STOP $BASHPID)&'|tee -a /start.sh \
 && echo 'wait'|tee -a /start.sh \
 && chmod a+x /start.sh
ENTRYPOINT ["bash","/start.sh"]

FROM debian:latest
MAINTAINER John Doe <[email protected]>
RUN apt-get update \
 && apt-get install -y nginx php5-fpm \
 && apt-get clean \
 && echo '#!/bin/bash'|tee /entry.sh \
 && echo 'function start() {'|tee -a /entry.sh \
 && echo '  service php5-fpm start'|tee -a /entry.sh \
 && echo '  service nginx start'|tee -a /entry.sh \
 && echo '}'|tee -a /entry.sh \
 && echo ''|tee -a /entry.sh \
 && echo 'function stop() {'|tee -a /entry.sh \
 && echo '  service php5-fpm stop'|tee -a /entry.sh \
 && echo '  service nginx stop'|tee -a /entry.sh \
 && echo '}'|tee -a /entry.sh \
 && echo 'trap stop INT TERM'|tee -a /entry.sh \
 && echo ''|tee -a /entry.sh \
 && echo '(kill -SIGSTOP $BASHPID)&'|tee -a /entry.sh \
 && echo 'wait'|tee -a /entry.sh \
 && chmod a+x /entry.sh
ENTRYPOINT /entry.sh