diff --git a/Dockerfile b/Dockerfile index ead605c..38b22c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,18 +47,7 @@ RUN echo \ pip install -r requirements.txt && \ cp -r /FeideUtstyrbase/BookingSystem/* /app" > /usr/local/bin/auto-update.sh -# Entrypoint (Update / run) -RUN echo \ - "if [ \"\$AUTO_UPDATE\" = \"True\" ]; then \ - echo \"Auto update enabled\" && \ - sh /usr/local/bin/auto-update.sh; \ - else \ - echo \"Auto update disabled (AUTO_UPDATE not True)\"; \ - fi && \ - if [ -d \"/overrides\" ]; then \ - cp -r /overrides/* /app; \ - fi && \ - gunicorn -b 0.0.0.0:5000 app:app" > /usr/local/bin/entrypoint.sh +COPY entrypoint.sh /usr/local/bin/entrypoint.sh EXPOSE 5000 WORKDIR /app diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..8d3ace3 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,20 @@ +if [ "$AUTO_UPDATE" = "True" ]; then + echo "Auto update enabled" + sh /usr/local/bin/auto-update.sh; +else + echo "Auto update disabled (AUTO_UPDATE not True)"; +fi + +if [ -d "/overrides" ]; then + cp -r /overrides/* /app; +fi + +shutdown() { + kill -TERM $PID && wait $PID +} + +trap "shutdown" TERM + +gunicorn --bind 0.0.0.0:5000 app:app & +PID=$! +wait $PID