phpmentors-jp / docker-images

https://registry.hub.docker.com/u/phpmentors/
MIT License
26 stars 14 forks source link

Any ways to add some extra extensions ? #23

Open apsylone opened 8 years ago

apsylone commented 8 years ago

Hi Mentors :-)

I would like to know if there is any ways to add some extras PHP5 extensions ? In my case, I would like to add memcached.

Thanks for your anwser :-)

iteman commented 8 years ago

The APP_INIT environment variable can be used for this.

First, write a script as the following:

docker/app-init:

#!/bin/bash

apt-get update
apt-get -y upgrade

apt-get -y install php5-gd
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
   exit $RETVAL
fi

...

Second, specify the script as the value of the APP_INIT_SCRIPT environment variable as the following:

docker-compose.yml:

version: '2'
services:
    app:
        image: "phpmentors/symfony-app:php55"
        ...
        environment:
            APP_INIT_SCRIPT: "docker/app-init"
        ...

If the value of the APP_INIT_SCRIPT environment variable is relative path, /var/app will be added to the beginning of the value.