Skip to content

Instantly share code, notes, and snippets.

@mascot6699
Created June 23, 2019 21:39
Show Gist options
  • Save mascot6699/9e4d7d20bceec3bf94080a2dd0266b2f to your computer and use it in GitHub Desktop.
Save mascot6699/9e4d7d20bceec3bf94080a2dd0266b2f to your computer and use it in GitHub Desktop.
DOCKER_KATAS
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello! I am a Flask application'
if __name__ == '__main__':
# Note the extra host argument. If we didn't have it, our Flask app
# would only respond to requests from inside our container
app.run(host='0.0.0.0')
# The base image
FROM ubuntu:latest
# Install python and pip
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
# Install Python modules needed by the Python app
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
# Copy files required for the app to run
COPY app.py /usr/src/app/
# Declare the port number the container should expose
EXPOSE 5000
# Run the application
CMD ["python", "/usr/src/app/app.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment