Add check for development env var in entrypoint

This commit is contained in:
Dale Davies
2022-02-14 21:47:19 +00:00
parent 85b0ee51cd
commit f2fe3597a7

View File

@@ -1,37 +1,39 @@
#!/usr/bin/env bash
set -Eeuo pipefail
echo >&2 "-------------------------------------------------------------"
if [ ! $DEVELOPMENT ]; then
echo >&2 "-------------------------------------------------------------"
echo >&2 "- Repopulating web root with application files."
if [ "$(ls -A /var/www/html)" ]; then
rm /var/www/html/* -r
fi
cp /usr/src/jumpapp/* /var/www/html -r
echo >&2 "- Check if backgrounds or sites volumes have been mounted."
if [ -e "/backgrounds" ]; then
echo >&2 " - Backgrounds directory is mapped... symlinking."
rm /var/www/html/assets/backgrounds -r
ln -s /backgrounds /var/www/html/assets/
if [ ! "$(ls -A /backgrounds)" ]; then
echo >&2 " -- Empty so populating with default files."
cp /usr/src/jumpapp/assets/backgrounds/* /backgrounds -r
echo >&2 "- Repopulating web root with application files."
if [ "$(ls -A /var/www/html)" ]; then
rm /var/www/html/* -r
fi
fi
cp /usr/src/jumpapp/* /var/www/html -r
if [ -e "/sites" ]; then
echo >&2 " - Sites directory is mapped... symlinking."
rm /var/www/html/sites -r
ln -s /sites /var/www/html/
if [ ! "$(ls -A /sites)" ]; then
echo >&2 " -- Empty so populating with default files."
cp /usr/src/jumpapp/sites/* /sites -r
echo >&2 "- Check if backgrounds or sites volumes have been mounted."
if [ -e "/backgrounds" ]; then
echo >&2 " - Backgrounds directory is mapped... symlinking."
rm /var/www/html/assets/backgrounds -r
ln -s /backgrounds /var/www/html/assets/
if [ ! "$(ls -A /backgrounds)" ]; then
echo >&2 " -- Empty so populating with default files."
cp /usr/src/jumpapp/assets/backgrounds/* /backgrounds -r
fi
fi
fi
echo >&2 "- All done! Starting nginx/php services now."
echo >&2 "-------------------------------------------------------------"
if [ -e "/sites" ]; then
echo >&2 " - Sites directory is mapped... symlinking."
rm /var/www/html/sites -r
ln -s /sites /var/www/html/
if [ ! "$(ls -A /sites)" ]; then
echo >&2 " -- Empty so populating with default files."
cp /usr/src/jumpapp/sites/* /sites -r
fi
fi
echo >&2 "- All done! Starting nginx/php services now."
echo >&2 "-------------------------------------------------------------"
fi
php-fpm8
nginx -g 'daemon off;'