Skip to content

Commit ae67ce2

Browse files
author
wellington90
committed
mensagem do commit
0 parents  commit ae67ce2

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

app.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
from flask import Flask
3+
import redis
4+
5+
app = Flask(__name__)
6+
r = redis.Redis(host=os.environ.get('REDIS_HOST', 'redis'), port=6379, db=0)
7+
8+
@app.route('/')
9+
def index():
10+
count = r.incr('counter')
11+
return 'This page has been refreshed {} times.'.format(count)
12+
13+
if __name__ == '__main__':
14+
app.run(host='0.0.0.0')

docker-compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3'
2+
services:
3+
web:
4+
build: .
5+
ports:
6+
- "5000:5000"
7+
redis:
8+
image: "redis:6.0.6"

dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.9
2+
3+
WORKDIR /app
4+
COPY . .
5+
6+
RUN pip install -r requirements.txt
7+
8+
CMD ["python", "app.py"]

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask
2+
redis

0 commit comments

Comments
 (0)