diff --git a/Dockerfile b/Dockerfile index 088341f4..b976e7ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ RUN chmod +x ./strapi.sh EXPOSE 1337 -CMD ./strapi.sh +CMD ["./strapi.sh"] diff --git a/strapi.sh b/strapi.sh index 4a04f30f..886b30e9 100755 --- a/strapi.sh +++ b/strapi.sh @@ -1,6 +1,14 @@ #!/bin/sh set -ea +_stopStrapi() { + echo "Stopping strapi" + kill -SIGINT "$strapiPID" + wait "$strapiPID" +} + +trap _stopStrapi SIGTERM SIGINT + cd /usr/src/api APP_NAME=${APP_NAME:-strapi-app} @@ -15,4 +23,7 @@ then fi cd $APP_NAME -strapi start \ No newline at end of file +strapi start & + +strapiPID=$! +wait "$strapiPID"