Skip to content

Commit 1ef342d

Browse files
committedFeb 18, 2018
--update : flask container and fixes
1 parent 3f05c5c commit 1ef342d

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed
 

‎apparel/.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

‎docker-compose.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ services:
1010
depends_on:
1111
- database
1212
ports:
13-
- 5001:80
13+
- 5001:80
14+
prices:
15+
build: ./prices
16+
volumes:
17+
- ./prices:/app
18+
depends_on:
19+
- apparel
20+
ports:
21+
- 5002:80

‎prices/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python
2+
WORKDIR app
3+
COPY requirements.txt .
4+
RUN pip install -r requirements.txt
5+
COPY . .
6+
EXPOSE 80
7+
CMD [ "python", "app.py" ]

‎prices/app.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
import requests
3+
from flask import Flask, jsonify
4+
5+
app = Flask(__name__)
6+
7+
8+
@app.route('/')
9+
def prices():
10+
data = requests.get('http://apparel/').json()
11+
12+
for i in range(len(data)):
13+
data[i]['price'] = (i * 5) + 10
14+
15+
return jsonify(data)
16+
17+
18+
if __name__ == '__main__':
19+
app.run(host='0.0.0.0', port=80)

‎prices/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==0.12
2+
requests==2.18

0 commit comments

Comments
 (0)