Skip to content

Commit

Permalink
re-organized the entire app. finished docker setup for flask-app
Browse files Browse the repository at this point in the history
  • Loading branch information
prakhar1989 committed Jan 7, 2016
1 parent 800c867 commit b8b2312
Show file tree
Hide file tree
Showing 46 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
node_modules
venv
.DS_Store
elasticsearch
elasticsearch/dist
24 changes: 20 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# our base image
from python:3-onbuild
# start from base
FROM ubuntu:14.04
MAINTAINER Prakhar Srivastav <[email protected]>

# expose the port
# install system-wide deps for python and node
RUN apt-get -yqq update
RUN apt-get -yqq install python-pip python-dev
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node

# copy our application code
ADD flask-app /opt/flask-app
WORKDIR /opt/flask-app

# fetch app specific deps
RUN npm install
RUN npm run build
RUN pip install -r requirements.txt

# expose port
EXPOSE 5000

# run the command
# start app
CMD [ "python", "./app.py" ]
Empty file added elasticsearch/Dockerfile
Empty file.
File renamed without changes.
4 changes: 4 additions & 0 deletions elasticsearch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
elasticsearch==2.2.0
requests==2.9.1
urllib3==1.14
wheel==0.24.0
3 changes: 2 additions & 1 deletion app.py → flask-app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ def search():
})

if __name__ == "__main__":
app.run(debug=True)
#app.run(debug=True) # for dev
app.run(host='0.0.0.0', port=5000) # for prod
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions utils/setup-docker.sh → setup-docker.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# build the flask container
docker build -t prakhar1989/flask-es .
docker build -t prakhar1989/flask-app .

# create the network
docker create network es
Expand All @@ -11,4 +13,5 @@ docker run -d --net es -p 9200:9200 -h es-primary --name es-primary elasticsearc
python load_data.py -i "0.0.0.0" -p "9200"

# start the flask app container
docker run -d --net es --name flaskapp -p 5000:5000 prakhar1989/flask-es
docker run -d --net es --name flask_app -p 5000:5000 prakhar1989/flask-es

0 comments on commit b8b2312

Please sign in to comment.