This simple application fetches the setup and punchline from a joke API. The larger point is to demonstrate the steps involved to containerize a Python application and its dependencies.
Create a Python virtual environment and install the requests library. You can then test the script
by running:
python joke.py
Feel free to inspect the full JSON payload from the API, or customize the output however you like.
To build the container:
docker build -t joke-machine .
In this case joke-machine will be the name of your container image. Don't forget to include the trailing dot at the
end of the command, which directs docker build as to where to find the Dockerfile.
To run the joke machine image:
docker run joke-machine