Running Quart in Docker
To run a Quart application in Docker, we can use the base Python image. From there, installing the app and its dependencies can be done via pip, which is already installed in the Python image.
Assuming your project has a requirements.txt
file for its pinned dependencies, and a setup.py
file that installs the project, creating an image for your project can be done by instructing Docker on how to use the pip
command.
In the following example, we introduce the COPY
command, which will recursively copy files and directories from outside the container into the image. We also add the EXPOSE
directive to indicate to anyone running the container that this port should be exposed to the outside world. We still need to connect that exposed port when we run the container with the -p
option. Any process inside the container can listen to any ports that it wants to, and communicate with itself using localhost, but anything outside the container won't be able...