diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32c15d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.5 +RUN apk add --update py2-pip +COPY requirements.txt /usr/src/app/ +RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt +COPY app.py /usr/src/app/ +COPY templates/index.html /usr/src/app/templates/ +EXPOSE 5000 +CMD ["python", "/usr/src/app/app.py"] diff --git a/app.py b/app.py new file mode 100644 index 0000000..478f1a0 --- /dev/null +++ b/app.py @@ -0,0 +1,28 @@ +from flask import Flask, render_template +import random + +app = Flask(__name__) + +# list of cat images +images = [ + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26388-1381844103-11.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr01/15/9/anigif_enhanced-buzz-31540-1381844535-8.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26390-1381844163-18.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-1376-1381846217-0.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3391-1381844336-26.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-29111-1381845968-0.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3409-1381844582-13.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr02/15/9/anigif_enhanced-buzz-19667-1381844937-10.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26358-1381845043-13.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-18774-1381844645-6.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-25158-1381844793-0.gif", + "http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/10/anigif_enhanced-buzz-11980-1381846269-1.gif" +] + +@app.route('/') +def index(): + url = random.choice(images) + return render_template('index.html', url=url) + +if __name__ == "__main__": + app.run(host="0.0.0.0") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..632a1ef --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask==0.10.1 diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..4590e06 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,27 @@ + +
+ + + +Courtesy: Buzzfeed
+