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.

Revisions

  1. BrandonLMorris created this gist Mar 15, 2016.
    27 changes: 27 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    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
    10 changes: 10 additions & 0 deletions app.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    """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')
    6 changes: 6 additions & 0 deletions requirements.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    Flask==0.10.1
    itsdangerous==0.24
    Jinja2==2.8
    MarkupSafe==0.23
    Werkzeug==0.11.4
    wheel==0.24.0