-# Gevent needs gcc
-RUN apk update && apk add gcc musl-dev
-
-# Switch to a non-root user for security reasons
-# This is only really needed in stage 2 however this makes the copying easier and straitforward! --user doesn't do the same thing if run as root!
+# upgrade pip as root
+RUN pip install --upgrade pip
+# Gevent needs gcc, make, file, ffi
+RUN apk update && apk add gcc musl-dev make file libffi-dev
+# create a non-root user. Only really needed in stage 2,
+# however this makes the copying easier and straighttforward;
+# pip option --user doesn't do the same thing if run as root