Skip to content

Commit 0de070d

Browse files
committed
first commit
0 parents  commit 0de070d

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc

template/python27-flask/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM python:2.7-alpine
2+
3+
# Alternatively use ADD https:// (which will not be cached by Docker builder)
4+
RUN apk --no-cache add curl \
5+
&& echo "Pulling watchdog binary from Github." \
6+
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.2.1/of-watchdog > /usr/bin/fwatchdog \
7+
&& chmod +x /usr/bin/fwatchdog \
8+
&& apk del curl --no-cache
9+
10+
WORKDIR /root/
11+
12+
COPY requirements.txt .
13+
RUN pip install -r requirements.txt
14+
COPY index.py .
15+
16+
RUN mkdir -p function
17+
RUN touch ./function/__init__.py
18+
WORKDIR /root/function/
19+
COPY function/requirements.txt .
20+
RUN pip install -r requirements.txt
21+
22+
WORKDIR /root/
23+
COPY function function
24+
25+
ENV fprocess="python index.py"
26+
ENV cgi_headers="true"
27+
ENV mode="http"
28+
ENV upstream_url="http://127.0.0.1:5000"
29+
30+
31+
HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1
32+
33+
CMD ["fwatchdog"]

template/python27-flask/function/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def handle(st):
2+
return "You said: " + st
3+

template/python27-flask/function/requirements.txt

Whitespace-only changes.

template/python27-flask/index.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) Alex Ellis 2017. All rights reserved.
2+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
from flask import Flask, request
5+
from function import handler
6+
7+
app = Flask(__name__)
8+
9+
@app.route("/", methods=["POST", "GET"])
10+
def main_route():
11+
ret = handler.handle(request.get_data())
12+
return ret
13+
14+
if __name__ == '__main__':
15+
app.run(host='0.0.0.0', port=5000, debug=False)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flask
2+

template/python27-flask/template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language: python27-flask
2+
fprocess: python index.py

0 commit comments

Comments
 (0)