diff --git a/Dockerfile b/Dockerfile
index a077704dbb73ad07cff642d9666ddb5b7b3c0444..0ceeff2b042c258eb36ec2fd22f3760b3e22e386 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.8-slim-buster
+FROM python:3.12-slim-bookworm
 
 ENV ANSIBLE_STDOUT_CALLBACK=default
 ENV ANSIBLE_RETRY_FILES_ENABLED=0
@@ -8,7 +8,7 @@ ENV PIP_EXTRA_INDEX_URL="https://gitlab.ics.muni.cz/api/v4/projects/2358/package
 
 RUN apt update && apt install -y gnupg2 git autossh
 
-RUN pip3 install ansible==5.* pypsrp requests[socks] automated-problem-generation-lib
+RUN pip3 install ansible==9.* pypsrp requests[socks] automated-problem-generation-lib
 
 RUN rm -rf /var/cache/apt/