-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstartup.sh
47 lines (40 loc) · 1.83 KB
/
startup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
ENV_CONF=/etc/php5/fpm/pool.d/env.conf
echo "Configuring Nginx and PHP5-FPM with environment variables"
# Update php5-fpm with access to Docker environment variables
echo '[www]' > $ENV_CONF
for var in $(env | awk -F= '{print $1}')
do
if [[ ${!var} =~ [=\"] ]] ; then
echo "Bad Value Not Added!"
else
if [[ ! -z ${!var} ]] ; then
echo "Adding variable {$var}"
echo "env[${var}] =\"${!var}\"" >> $ENV_CONF
else
echo "Empty variable"
fi
fi
done
# We need to configure the /etc/hosts file so sendmail works properly
# sendmail needs in this file something in the form of host.domain
# this is actually really easy to do with docker itself, adding -h something.localdomain
# when running the container, but it presents two problems:
# first, it doesn't work with maestro-ng and many other solutions that don't support
# the -h argument
# second, there's no way to use the container's name, when using -h we need to define
# the container's name so is not an ideal solution because other thinks can break
# when setting the name manually
# We then just rewrite the hosts file
#echo "Configuring /etc/hosts"
#CONTAINER_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
#CONTAINER_NAME=$(echo $HOSTNAME)
#echo $CONTAINER_IP " " $CONTAINER_NAME $CONTAINER_NAME".localdomain" > /etc/hosts
#echo "127.0.0.1 localhost" >> /etc/hosts
#echo "::1 localhost ip6-localhost ip6-loopback" >> /etc/hosts
#echo "fe00::0 ip6-localnet" >> /etc/hosts
#echo "ff00::0 ip6-mcastprefix" >> /etc/hosts
#echo "ff02::1 ip6-allnodes" >> /etc/hosts
#echo "ff02::2 ip6-allrouters" >> /etc/hosts
if [ "$PHP_OPCACHE" == "disabled" ]; then sed -i 's/$zend_extension=opcache.so/;zend_extension=opcache.so/'; fi
if [ "$PHP_OPCACHE" == "enabled" ]; then sed -i 's/;$zend_extension=opcache.so/zend_extension=opcache.so/'; fi