-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
31 lines (26 loc) · 1.04 KB
/
entrypoint.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
#!/bin/bash
# Disable Strict Host checking for non interactive git clones
mkdir -p -m 0700 /root/.ssh
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
# Display PHP error's or not
if [[ "$ERRORS" != "1" ]] ; then
sed -i -e "s/error_reporting =.*=/error_reporting = E_ALL/g" /etc/php/php.ini
sed -i -e "s/display_errors =.*/display_errors = On/g" /etc/php/php.ini
fi
# Tweak nginx to match the workers to cpu's
procs=$(cat /proc/cpuinfo | grep processor | wc -l)
sed -i -e "s/worker_processes 5/worker_processes $procs/" /etc/nginx/nginx.conf
# Very dirty hack to replace variables in code with ENVIRONMENT values
if [[ "$TEMPLATE_NGINX_HTML" != "0" ]] ; then
for i in $(env)
do
variable=$(echo "$i" | cut -d'=' -f1)
value=$(echo "$i" | cut -d'=' -f2)
if [[ "$variable" != '%s' ]] ; then
replace='\$\$_'${variable}'_\$\$'
find /usr/share/nginx/html -type f -exec sed -i -e 's/'${replace}'/'${value}'/g' {} \;
fi
done
fi
# Start supervisord and services
/usr/bin/supervisord -n -c /etc/supervisord.conf