diff --git a/dockerfile b/dockerfile index cde5bd4..52e0780 100644 --- a/dockerfile +++ b/dockerfile @@ -40,4 +40,4 @@ ENV PYTHONUNBUFFERED=1 ENV CONFIG_PATH=/app/config.ini # Run the bot using the entrypoint script -ENTRYPOINT ["/app/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/sh", "/app/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index bf8aca0..e3d94ca 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,13 @@ #!/bin/sh # Run the application in the background -python generate_config.py && python pterodisbot.py \ No newline at end of file +python generate_config.py && python pterodisbot.py & + +# Capture the application's process ID +pid=$! + +# Trap the SIGTERM signal and pass it through to the process upon stopping the container +trap "kill -TERM $pid" SIGTERM + +# Wait for process to complete +wait $pid \ No newline at end of file