Skip to content

Commit

Permalink
Dedicated entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Aug 26, 2023
1 parent 67f58f2 commit 6923ce9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6923ce9

Please sign in to comment.