Skip to content

Instantly share code, notes, and snippets.

@BrandonLMorris
Created March 15, 2016 18:57
Show Gist options
  • Save BrandonLMorris/10b4ae28bec9935ff7a6 to your computer and use it in GitHub Desktop.
Save BrandonLMorris/10b4ae28bec9935ff7a6 to your computer and use it in GitHub Desktop.
Dockerized Flask Example
"""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')
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
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