app.py: The main Flask application file that contains the routes and logic for the user registration form.Dockerfile: The Dockerfile used to build the Docker image for the Flask application.Dockerfile.test: The Dockerfile used to build the Docker image for running unit tests on the Flask application.requirements.txt: A file listing the Python dependencies required to run the Flask application.templates/: A directory containing HTML templates for the Flask application.register.html: The HTML template for the user registration form.success.html: The HTML template displayed after a successful user registration.
To build the Docker image for the Flask application, run the following command:
docker build --no-cache -t simple-flask-app .To run the Docker container for the Flask application, use the following command:
docker run -p 80:80 simple-flask-appAfter running the container, open your web browser and navigate to http://0.0.0.0:80/register to access the user registration form.
To run the unit tests for app.py using Docker, follow these steps:
- Build the Docker image for testing:
docker build -f Dockerfile.test -t simple-flask-app-test .- Run the Docker container to execute the tests:
docker run simple-flask-app-testThis command will discover and run all the unit tests in the test_app.py file.