This project demonstrates the usage of Docker for containerization of our Ascii Art Web project. It includes a Dockerfile for creating a Docker image, from which a Container can be run from a sample of that image. Metadata is applied to Docker objects, and unused objects are managed to avoid unnecessary resource consumption.
This section illustrates how to make use of this program.
To run this program, download and install the latest version of Go from here
- Clone this repository on to the terminal by using the following command:
git clone https://github.com/JosephOkumu/Dockerize-Web-AsciiArt.git
- Navigate into the ascii-art-web directory by using the command:
cd ascii-art-dockerize
- You can skip step 3 and 4 by typing the following commands on the terminal:
chmod +x deploy.sh
./deploy.sh
- Build a sample Docker image by running the following command:
docker build -t your-docker-image:latest .
- "your-docker-image" is the name of the sample Docker image. "latest" is the tag for the image. You can choose a different tag if needed.
- Run a container from the image you just built using the following command:
docker run -dp 8080:8080 --name container-name your-docker-image-latest
- Navigate to localhost port 8080 to view the web version of our project by entering this url in your browser:
http://localhost/8080
A form will be displayed, and on the form, enter your input text in the text field, choose banner format and click "Convert to Ascii Art". Example: When you type "hello" and select "standard" as the banner format, then upon clicking "Convert to ASCII Art," the following output will be displayed on a new page.
_ _ _
| | | | | |
| |__ ___ | | | | ___
| _ \ / _ \ | | | | / _ \
| | | | | __/ | | | | | (_) |
|_| |_| \___| |_| |_| \___/
- This program can write the ascii-art graphical representation to a new page.
- This program allows you to select a banner file format to display the ascii art.
- The web pages of this program are styled and are responsive.
- This program has our own extra customized banner file.
- Root ("/)
- Ascii-art ("/ascii-art)
- Set up HTTP server using Go's 'net/http' package.
- Define route handlers for both endpoints:
- In the root handler serve the main page with a form for input text.
- In the ascii-art handler:
- Parse data from the request.
- Read the appropriate ASCII art file based on user input
- Process file contents to generate ASCII art.
- Generate HTML response with the ASCII art.
- Write HTML to response writer.
User Input -> Server -> File Read -> ASCII Art Generation -> HTML Response -> Web Browser
Pull requests are welcome where users of this program are allowed to contribute to this project in terms of adding features, or fixing bugs.
For major changes, please open an issue first to discuss what you would like to change.