diff --git a/Dockerfile b/Dockerfile
index 79dcb52d7353126e9af126fd71495f691673a7e3..74df5b8ef6310271af14ed22d07e8ef53d5b00e8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -58,6 +58,5 @@ EXPOSE 8080
 
 HEALTHCHECK --interval=1m --timeout=3s CMD curl -f 'http://localhost:8080/goemaxima?health=1'
 
-# clear tmp because when kubernetes restarts a pod, it keeps the /tmp content even if it's tmpfs,
-# which means that on a restart caused by an overfull tmpfs, it will keep restarting in a loop
-CMD cd /tmp && rm --one-file-system -rf * && exec tini ${BIN}/goweb ${BIN}/maxima-optimised || echo oh no no >&2
+ENTRYPOINT ["tini", "--"]
+CMD exec "${BIN}/goweb" "${BIN}/maxima-optimised"
diff --git a/helmmaxima/templates/deployment.yaml b/helmmaxima/templates/deployment.yaml
index e44f8690822ea001a2b9a06178ca071e03c73193..8e16ec046c36c198b2b154061cda87b66caf8e13 100644
--- a/helmmaxima/templates/deployment.yaml
+++ b/helmmaxima/templates/deployment.yaml
@@ -86,6 +86,7 @@ spec:
         - name: tmptmpfs
           emptyDir:
             medium: "Memory"
+            sizeLimit: "{{ .Values.tmpfsSizeLimit }}"
         {{ if .Values.enableGitRollout }}
         - name: git
           emptyDir:
diff --git a/helmmaxima/values.yaml b/helmmaxima/values.yaml
index b56de385148fc66c165df21037055bd717929a70..9e011d5487d46d9a642a3b1cc349adfaab5c7235 100644
--- a/helmmaxima/values.yaml
+++ b/helmmaxima/values.yaml
@@ -62,6 +62,9 @@ resources:
     cpu: 1000m
     memory: 256Mi
 
+# maximum size of /tmp
+tmpfsSizeLimit: 128Mi
+
 nodeSelector: {}
 
 tolerations: []