A python app needed to be Dockerized, and then it needs to be deployed on App Server 2. We have already copied a requirements.txt file (having the app dependencies) under /python_app/src/ directory on App Server 2. Further complete this task as per details mentioned below:
- Create a
Dockerfileunder/python_appdirectory:
- Use any
pythonimage as the base image. - Install the dependencies using
requirements.txtfile. - Expose the port
5001. - Run the
server.pyscript usingCMD.
-
Build an image named
nautilus/python-appusing this Dockerfile. -
Once image is built, create a container named
pythonapp_nautilus:
- Map port
5001of the container to the host port8092.
- Once deployed, you can test the app using
curlcommand onApp Server 2.