-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-entrypoint
43 lines (35 loc) · 1.31 KB
/
docker-entrypoint
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
#!/bin/bash
# Fix permission ownership
/fix-permission www-data www-data /usr/local/nginx/html/
# Create PHP error log if not present
# touch /usr/local/nginx/logs/error-php.log
# chown www-data:www-data /usr/local/nginx/logs/error-php.log
# Update PHP composer
# By default, we will try to update to the most recent version of PHP composer.
# However, this blocks starting the initial process IF you have a bad or no Internet connection at
# all. To avoid this, you can start the container with SKIP_COMPOSER_UPDATE env set to 1.
if [[ $SKIP_COMPOSER_UPDATE != "1" ]]; then
composer selfupdate -vvvn
fi
# Enable Xdebug
# Use Xdebug if ENABLE_XDEBUG env is set to 1.
if [[ $ENABLE_XDEBUG == "1" ]]; then
# Check if Xdebug extension is already enabled
touch /usr/local/lib/php.ini
grep -xq 'zend_extension\s*=\s*/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so' /usr/local/lib/php.ini
if [[ $? != "0" ]]; then
echo "zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" >> /usr/local/lib/php.ini
fi
echo -e "\e[32mXdebug enabled\e[0m"
fi
# Deploy available crontabs
if [[ -d /crontab ]]; then
for crontab_file in $(ls /crontab); do
crontab -u $crontab_file /crontab/$crontab_file
done
fi
# Start Honcho
if [[ $1 == "server" ]]; then
exec honcho -d / start
fi
exec "$@"