Step 1. Create Dockerfile on https://github.com/IBM/deploy-python-openshift-tutorial.git
from alpine:latest RUN apk add --no-cache py3-pip \ && pip3 install --upgrade pip WORKDIR /app COPY . /app RUN pip3 --no-cache-dir install -r requirements.txt EXPOSE 5000 ENTRYPOINT ["python3"] CMD ["helloworld.py"]
Step 2. create helloworld.py in same repository
from flask import Flask # From module flask import class Flask app = Flask(__name__) # Construct an instance of Flask class for our webapp @app.route('/') # URL '/' to be handled by main() route handler def main(): """Say hello""" return 'Hello, world!' if __name__ == '__main__': # Script executed directly? print("Hello World! Built with a Docker file.") app.run(host="0.0.0.0", port=5000, debug=True,use_reloader=True)
Step 3. Create a demo project on OpenShift console and create an application with “From Dockerfile”
Step 4. input git url https://github.com/IBM/deploy-python-openshift-tutorial.git and port number 5000
Step 5. You will find new application once build completed
Step 6. open the url to verify the Flask web application
It’s perfect time to make some plans for the future
and it is time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or suggestions.
Perhaps you could write next articles referring to this article.
I want to read more things about it!
my blog :: CoolEdge Air Cooler