Skip to content

Commit e815593

Browse files
LucasRoesleralexellis
authored andcommitted
Remove gevent and use waitress in all templates
**What** - Update all templates to use waitress instead of gevent. This avoids the need to install things like gcc, make, or libffi-dev into the alpine images. The user can still install these via the ADDITIONAL_PACKAGES build arg, if they are needed. Signed-off-by: Lucas Roesler <[email protected]>
1 parent cb68fbf commit e815593

File tree

12 files changed

+19
-30
lines changed

12 files changed

+19
-30
lines changed

template/python27-flask/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openfaas/of-watchdog:0.7.2 as watchdog
1+
FROM openfaas/of-watchdog:0.7.7 as watchdog
22
FROM python:2.7-alpine
33

44
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog

template/python3-flask-armhf/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM openfaas/of-watchdog:0.7.2 as watchdog
1+
FROM openfaas/of-watchdog:0.7.7 as watchdog
22
FROM armhf/python:3.6-alpine
33

44
ARG ADDITIONAL_PACKAGE
55

66
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
77
RUN chmod +x /usr/bin/fwatchdog
88

9-
RUN apk --no-cache add musl-dev gcc make openssl-dev libffi-dev
9+
RUN apk --no-cache add openssl-dev ${ADDITIONAL_PACKAGE}
1010

1111
# Add non root user
1212
RUN addgroup -S app && adduser app -S -G app

template/python3-flask-armhf/index.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from flask import Flask, request
55
from function import handler
6-
#from gevent.wsgi import WSGIServer
7-
from gevent.pywsgi import WSGIServer
6+
from waitress import serve
87

98
app = Flask(__name__)
109

@@ -27,7 +26,4 @@ def main_route(path):
2726
return ret
2827

2928
if __name__ == '__main__':
30-
#app.run(host='0.0.0.0', port=5000, debug=False)
31-
32-
http_server = WSGIServer(('', 5000), app)
33-
http_server.serve_forever()
29+
serve(app, host='0.0.0.0', port=5000)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
flask
2-
gevent
2+
waitress
33

template/python3-flask-debian/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openfaas/of-watchdog:0.7.2 as watchdog
1+
FROM openfaas/of-watchdog:0.7.7 as watchdog
22
FROM python:3.7-slim-buster
33

44
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog

template/python3-flask-debian/index.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from flask import Flask, request
55
from function import handler
6-
#from gevent.wsgi import WSGIServer
7-
from gevent.pywsgi import WSGIServer
6+
from waitress import serve
87

98
app = Flask(__name__)
109

@@ -27,6 +26,4 @@ def main_route(path):
2726
return ret
2827

2928
if __name__ == '__main__':
30-
31-
http_server = WSGIServer(('0.0.0.0', 5000), app)
32-
http_server.serve_forever()
29+
serve(app, host='0.0.0.0', port=5000)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
flask
2-
gevent
2+
waitress
33

template/python3-flask/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openfaas/of-watchdog:0.7.2 as watchdog
1+
FROM openfaas/of-watchdog:0.7.7 as watchdog
22
FROM python:3.7-alpine
33

44
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
@@ -7,7 +7,7 @@ RUN chmod +x /usr/bin/fwatchdog
77
ARG ADDITIONAL_PACKAGE
88
# Alternatively use ADD https:// (which will not be cached by Docker builder)
99

10-
RUN apk --no-cache add musl-dev gcc make ${ADDITIONAL_PACKAGE}
10+
RUN apk --no-cache add openssl-dev ${ADDITIONAL_PACKAGE}
1111

1212
# Add non root user
1313
RUN addgroup -S app && adduser app -S -G app

template/python3-flask/index.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from flask import Flask, request
55
from function import handler
6-
#from gevent.wsgi import WSGIServer
7-
from gevent.pywsgi import WSGIServer
6+
from waitress import serve
87

98
app = Flask(__name__)
109

@@ -27,7 +26,4 @@ def main_route(path):
2726
return ret
2827

2928
if __name__ == '__main__':
30-
#app.run(host='0.0.0.0', port=5000, debug=False)
31-
32-
http_server = WSGIServer(('', 5000), app)
33-
http_server.serve_forever()
29+
serve(app, host='0.0.0.0', port=5000)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
flask
2-
gevent
2+
waitress
33

0 commit comments

Comments
 (0)