Browse Source

adding swap space to fly deployment

Rodja Trappe 1 year ago
parent
commit
991e7ec898
2 changed files with 17 additions and 1 deletions
  1. 12 0
      fly-entrypoint.sh
  2. 5 1
      fly.dockerfile

+ 12 - 0
fly-entrypoint.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+if [[ ! -z "$SWAP" ]]; then 
+  fallocate -l $(($(stat -f -c "(%a*%s/10)*7" .))) _swapfile
+  mkswap _swapfile 
+  swapon _swapfile
+fi
+
+free -hm
+df -h
+exec "$@"

+ 5 - 1
fly.dockerfile

@@ -29,4 +29,8 @@ RUN pip install .
 EXPOSE 8080
 EXPOSE 9062
 
-CMD python3 main.py
+COPY fly-entrypoint.sh /entrypoint.sh
+
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["python", "main.py"]