Sign inSign up

coffeenosugar/python-demo

By coffeenosugar

•Updated over 3 years ago

Image
0

842

coffeenosugar/python-demo repository overview

⁠Python Demo application

⁠Introduction

The Docker image built and pushed to Docker Hub from Gitlab pipeline. The resulting image is lightweight Flask web application. This application provides a simple web page that displays the current date and time, the local IP address of the container running the application, the public IP address of the host running the container, and the hostname of the container. It can be used as a demonstration tool for infrastructure testing or as a starting point for building more complex web applications.

⁠How to use

To create a Docker container from the image, use the following command:

$ docker run --name python-demo -p 8080:80 -d coffeenosugar/python-demo:latest

This command maps port 8080 on your local machine or server to port 80 on the container, where the Flask application is listening for incoming connections. You can change the port mapping if needed.

Once the container is running, you can access the web application by opening a web browser and navigating to http://localhost:8080 or http://host-ip:8080, depending on your setup.

To secure your connection with SSL/TLS, you can use a reverse proxy like Nginx or Apache. Configure the reverse proxy to forward incoming requests to the Docker container running the application, and obtain an SSL certificate from a certificate authority (CA) like Let's Encrypt. Set up the reverse proxy to use the SSL certificate and private key, and configure a redirection rule to forward all incoming HTTP requests to HTTPS.

To update the app.py file for debug mode, modify the app.run() line at the end of the file as follows:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)

Enabling debug mode allows for more detailed error messages and live code reloading during development. Debug mode should not be used in production environments as it can expose sensitive information and allow arbitrary code execution.

Tag summary

Content type

Image

Digest

sha256:ee49bff16…

Size

51.8 MB

Last updated

over 3 years ago

docker pull coffeenosugar/python-demo