Created
March 15, 2016 18:57
-
-
Save BrandonLMorris/10b4ae28bec9935ff7a6 to your computer and use it in GitHub Desktop.
Dockerized Flask Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A simple Flask app meant to be run inside a Docker container""" | |
import flask | |
app = flask.Flask(__name__) | |
@app.route('/') | |
def get_home(): | |
return 'Hello, world!' | |
app.run(debug=True, host='0.0.0.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
# Install Python Setuptools | |
RUN apt-get install -y python-setuptools | |
# Install pip | |
RUN easy_install pip | |
# Add and install Python Modules | |
ADD requirements.txt /src/requirements.txt | |
RUN cd /src; pip install -r requirements.txt | |
# Bundle app source | |
add . /src | |
# Expose the port | |
EXPOSE 5000 | |
# Run | |
CMD ["python", "/src/application.py"] | |
# To build this image: | |
# $ docker build -t flask-ex . | |
# To run this with shared directories | |
# $ docker run -d -p 5000:5000 --name flask -v $(pwd):/src flask-ex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Flask==0.10.1 | |
itsdangerous==0.24 | |
Jinja2==2.8 | |
MarkupSafe==0.23 | |
Werkzeug==0.11.4 | |
wheel==0.24.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment