This project demonstrates a multi-container Docker setup with a Go backend and a static frontend, allowing users to:
-
Perform simple calculations (add two numbers)
-
Display all results dynamically on a browser
-
The project is fully containerized with separate backend and frontend services.
project/
β
βββ BE/ # Backend service
β βββ Dockerfile # Backend Dockerfile
β βββ main.go # Go backend code
β
βββ UI/ # Frontend service
β βββ Dockerfile # Frontend Dockerfile
β βββ index.html # Main HTML page
β βββ static/
β βββ styles.css # Static files
βββ docker-compose.yaml # Docker Compose configuration
βββ README.md-
Accessible in the browser (port 9000)
-
Allows the user to:
-
Enter two numbers and click Calculate or press Enter
-
Display calculation results dynamically in a table
-
Press Restart to refresh the page
-
-
Styled with soft grey and orange tones and white backgrounds for inputs and table
-
Written in Go
-
Exposes APIs:
- /add β store a calculation dinamically
-
Multi-stage Docker build keeps image small and efficient
-
Backend container
-
Runs Go backend
-
Listens on port 8000
-
-
Frontend container
-
Serves static HTML/CSS/JS
-
Listens on port 9000
-
Communicates with backend via API
-
- Clone the repository
git clone <your-repository-url>
cd project- Build and run containers
docker compose up --build- Using the App
-
Open browser β
http://localhost:9000 -
Enter two numbers and click Calculate or press Enter
-
View the result in the table
-
Press Restart to refresh the page
This project uses Docker Compose to run two separate containers:
-
Backend container β runs the Go server handling calculation requests.
-
Frontend container β serves the static HTML, CSS, and JS interface in the browser.