From f2fe3597a7f1de93509fa9a34da6963e9749a602 Mon Sep 17 00:00:00 2001 From: Dale Davies Date: Mon, 14 Feb 2022 21:47:19 +0000 Subject: [PATCH] Add check for development env var in entrypoint --- docker/entrypoint.sh | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index f64ab52..02100ff 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -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;'