Explorar o código

adding swap space to fly deployment

Rodja Trappe hai 1 ano
pai
achega
991e7ec898
Modificáronse 2 ficheiros con 17 adicións e 1 borrados
  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 8080
 EXPOSE 9062
 EXPOSE 9062
 
 
-CMD python3 main.py
+COPY fly-entrypoint.sh /entrypoint.sh
+
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["python", "main.py"]