Update compose #288

This commit is contained in:
khs1994
2017-12-10 11:52:09 +08:00
parent 6bcce7e562
commit 8939af4f97
9 changed files with 63 additions and 299 deletions

View File

@@ -0,0 +1,5 @@
FROM python:3.6-alpine
ADD . /code
WORKDIR /code
RUN pip install redis flask
CMD ["python", "app.py"]

13
compose/demo/app/app.py Normal file
View File

@@ -0,0 +1,13 @@
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
count = redis.incr('hits')
return 'Hello World! 该页面已被访问 {} 次。\n'.format(count)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)

View File

@@ -0,0 +1,10 @@
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"