提交 24095d85 authored 作者: 陈欢's avatar 陈欢

更新 start.sh

上级 134ccf76
...@@ -34,51 +34,51 @@ if [ ! -z "$OPcache" ]; then ...@@ -34,51 +34,51 @@ if [ ! -z "$OPcache" ]; then
sed -i 's#zend_extension=opcache#;zend_extension=opcache#g' /usr/local/etc/php/php.ini sed -i 's#zend_extension=opcache#;zend_extension=opcache#g' /usr/local/etc/php/php.ini
fi fi
# Setup git variables # # Setup git variables
if [ ! -z "$GIT_EMAIL" ]; then # if [ ! -z "$GIT_EMAIL" ]; then
git config --global user.email "$GIT_EMAIL" # git config --global user.email "$GIT_EMAIL"
fi # fi
if [ ! -z "$GIT_NAME" ]; then # if [ ! -z "$GIT_NAME" ]; then
git config --global user.name "$GIT_NAME" # git config --global user.name "$GIT_NAME"
git config --global push.default simple # git config --global push.default simple
fi # fi
# Dont pull code down if the .git folder exists # # Dont pull code down if the .git folder exists
if [ ! -d "/var/www/html/.git" ]; then # if [ ! -d "/var/www/html/.git" ]; then
# Pull down code from git for our site! # # Pull down code from git for our site!
if [ ! -z "$GIT_REPO" ]; then # if [ ! -z "$GIT_REPO" ]; then
# Remove the test index file if you are pulling in a git repo # # Remove the test index file if you are pulling in a git repo
if [ ! -z ${REMOVE_FILES} ] && [ ${REMOVE_FILES} == 0 ]; then # if [ ! -z ${REMOVE_FILES} ] && [ ${REMOVE_FILES} == 0 ]; then
echo "skiping removal of files" # echo "skiping removal of files"
else # else
rm -Rf /var/www/html/* # rm -Rf /var/www/html/*
fi # fi
GIT_COMMAND='git clone ' # GIT_COMMAND='git clone '
if [ ! -z "$GIT_BRANCH" ]; then # if [ ! -z "$GIT_BRANCH" ]; then
GIT_COMMAND=${GIT_COMMAND}" -b ${GIT_BRANCH}" # GIT_COMMAND=${GIT_COMMAND}" -b ${GIT_BRANCH}"
fi # fi
if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then # if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then
GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}" # GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}"
else # else
if [[ "$GIT_USE_SSH" == "1" ]]; then # if [[ "$GIT_USE_SSH" == "1" ]]; then
GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}" # GIT_COMMAND=${GIT_COMMAND}" ${GIT_REPO}"
else # else
GIT_COMMAND=${GIT_COMMAND}" https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO}" # GIT_COMMAND=${GIT_COMMAND}" https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO}"
fi # fi
fi # fi
${GIT_COMMAND} /var/www/html || exit 1 # ${GIT_COMMAND} /var/www/html || exit 1
if [ ! -z "$GIT_TAG" ]; then # if [ ! -z "$GIT_TAG" ]; then
git checkout ${GIT_TAG} || exit 1 # git checkout ${GIT_TAG} || exit 1
fi # fi
if [ ! -z "$GIT_COMMIT" ]; then # if [ ! -z "$GIT_COMMIT" ]; then
git checkout ${GIT_COMMIT} || exit 1 # git checkout ${GIT_COMMIT} || exit 1
fi # fi
if [ -z "$SKIP_CHOWN" ]; then # if [ -z "$SKIP_CHOWN" ]; then
chown -Rf nginx.nginx /var/www/html # chown -Rf nginx.nginx /var/www/html
fi # fi
fi # fi
fi # fi
# Enable custom nginx config files if they exist # Enable custom nginx config files if they exist
if [ -f /var/www/html/conf/nginx/nginx.conf ]; then if [ -f /var/www/html/conf/nginx/nginx.conf ]; then
...@@ -157,38 +157,38 @@ if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then ...@@ -157,38 +157,38 @@ if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then
sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /usr/local/etc/php/conf.d/docker-vars.ini sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /usr/local/etc/php/conf.d/docker-vars.ini
fi fi
# Enable xdebug # # Enable xdebug
XdebugFile='/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini' # XdebugFile='/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini'
if [[ "$ENABLE_XDEBUG" == "1" ]] ; then # if [[ "$ENABLE_XDEBUG" == "1" ]] ; then
if [ -f $XdebugFile ]; then # if [ -f $XdebugFile ]; then
echo "Xdebug enabled" # echo "Xdebug enabled"
else # else
echo "Enabling xdebug" # echo "Enabling xdebug"
echo "If you get this error, you can safely ignore it: /usr/local/bin/docker-php-ext-enable: line 83: nm: not found" # echo "If you get this error, you can safely ignore it: /usr/local/bin/docker-php-ext-enable: line 83: nm: not found"
# see https://github.com/docker-library/php/pull/420 # # see https://github.com/docker-library/php/pull/420
docker-php-ext-enable xdebug # docker-php-ext-enable xdebug
# see if file exists # # see if file exists
if [ -f $XdebugFile ]; then # if [ -f $XdebugFile ]; then
# See if file contains xdebug text. # # See if file contains xdebug text.
if grep -q xdebug.remote_enable "$XdebugFile"; then # if grep -q xdebug.remote_enable "$XdebugFile"; then
echo "Xdebug already enabled... skipping" # echo "Xdebug already enabled... skipping"
else # else
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $XdebugFile # Note, single arrow to overwrite file. # echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $XdebugFile # Note, single arrow to overwrite file.
echo "xdebug.remote_enable=1 " >> $XdebugFile # echo "xdebug.remote_enable=1 " >> $XdebugFile
echo "xdebug.remote_host=host.docker.internal" >> $XdebugFile # echo "xdebug.remote_host=host.docker.internal" >> $XdebugFile
echo "xdebug.remote_log=/tmp/xdebug.log" >> $XdebugFile # echo "xdebug.remote_log=/tmp/xdebug.log" >> $XdebugFile
echo "xdebug.remote_autostart=false " >> $XdebugFile # I use the xdebug chrome extension instead of using autostart # echo "xdebug.remote_autostart=false " >> $XdebugFile # I use the xdebug chrome extension instead of using autostart
# NOTE: xdebug.remote_host is not needed here if you set an environment variable in docker-compose like so `- XDEBUG_CONFIG=remote_host=192.168.111.27`. # # NOTE: xdebug.remote_host is not needed here if you set an environment variable in docker-compose like so `- XDEBUG_CONFIG=remote_host=192.168.111.27`.
# you also need to set an env var `- PHP_IDE_CONFIG=serverName=docker` # # you also need to set an env var `- PHP_IDE_CONFIG=serverName=docker`
fi # fi
fi # fi
fi # fi
else # else
if [ -f $XdebugFile ]; then # if [ -f $XdebugFile ]; then
echo "Disabling Xdebug" # echo "Disabling Xdebug"
rm $XdebugFile # rm $XdebugFile
fi # fi
fi # fi
if [ ! -z "$PUID" ]; then if [ ! -z "$PUID" ]; then
if [ -z "$PGID" ]; then if [ -z "$PGID" ]; then
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论