Created
June 23, 2019 21:39
-
-
Save mascot6699/9e4d7d20bceec3bf94080a2dd0266b2f to your computer and use it in GitHub Desktop.
DOCKER_KATAS
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 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') |
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
# 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"] |
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.12.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment