diff --git a/server/Dockerfile b/server/Dockerfile index 8a54ead..81d310b 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -54,4 +54,4 @@ USER user WORKDIR /home/user # Run the server. -CMD ["start.sh"] +ENTRYPOINT ["start.sh"] diff --git a/server/bin/dz b/server/bin/dz index 170bbe9..34198fb 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -242,7 +242,7 @@ mergexml(){ # Start the server in the foreground start(){ # Ensure mpmissions has at least one map. If not, copy it from the local read-only volume that stores pristine mpmissons directories - if [ ! -d "${MPMISSIONS}/${MAP}" ] + if [ ! -d "${MPMISSIONS}/${MAP}" ] && [ -d "/mpmissions/${MAP}" ] then echo echo "Performing one-time copy of ${MAP} mpmissions..." @@ -253,7 +253,14 @@ start(){ if [[ ${DEVELOPMENT} = "1" ]] then echo "DEVELOPMENT mode, blocking. Unset DEVELOPMENT in the current environment to run the server." - tail -f /dev/null + trap ' + echo "Caught SIGTERM/SIGINT..." + exit 0 + ' SIGTERM SIGINT + while true + do + sleep 1 + done exit 0 fi # Do the report on exit. Set here so that it only happens once we're starting the server, and not for other actions. diff --git a/server/start.sh b/server/start.sh index d8749c0..7b83f9f 100755 --- a/server/start.sh +++ b/server/start.sh @@ -8,4 +8,4 @@ EOF # Start the server. # If the DEVELOPMENT environment variable is set to 1, the container will just block and not start the server. -dz start +exec dz start diff --git a/web/Dockerfile b/web/Dockerfile index 682fb0c..14d9bfa 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -81,4 +81,4 @@ USER user WORKDIR /home/user # Run the web server -CMD ["start.sh"] +ENTRYPOINT ["start.sh"] diff --git a/web/start.sh b/web/start.sh index 5df5610..4f9ac7d 100755 --- a/web/start.sh +++ b/web/start.sh @@ -1,15 +1,21 @@ #!/usr/bin/env bash # Set PS1 so we know we're in the container -if ! [ -f .bashrc ] +if ! echo .bashrc | grep -q "dz-web" then - echo "Creating .bashrc..." - cat > .bashrc <> .bashrc <