A simple Go-based API application containerized with Docker and deployable using Kubernetes.
- Developed in Go: Efficient and lightweight API application.
- Containerized with Docker: Multi-stage build for smaller, secure images.
- Deployed with Kubernetes: Easy scalability and management.
Ensure you have the following installed:
- Go (1.22 or higher)
- Docker
- Kubernetes (kubectl)
- A local Kubernetes cluster (e.g., Minikube or Docker Desktop).
git clone https://github.com/your-username/go-api-test.git
cd go-api-testUse the provided Dockerfile to build the Docker image:
docker build -t go-api-test:latest .Run the application locally:
docker run -p 8080:8080 go-api-test:latestAccess the application at http://localhost:8080.
If you are using Minikube or Docker Desktop, load the image:
minikube image load go-api-test:latestApply the Kubernetes manifest:
kubectl apply -f deployment.yamlVerify the pod is running:
kubectl get podsPort-forward to access the API:
kubectl port-forward deployment/go-api-test 8080:8080Visit http://localhost:8080.
Alternatively, expose the deployment with a Kubernetes Service.
📦go-api-test
┣ 📂.vscode
┃ ┗ 📜launch.json
┣ 📂internal
┃ ┗ 📂user
┃ ┃ ┣ 📜handler.go
┃ ┃ ┣ 📜repository.go
┃ ┃ ┗ 📜service.go
┣ 📂pkg
┃ ┗ 📂routes
┃ ┃ ┗ 📜router.go
┣ 📂tests
┃ ┣ 📂integration
┃ ┃ ┣ 📜suite_test.go
┃ ┃ ┗ 📜user_api_test.go
┃ ┗ 📂mocks
┃ ┃ ┗ 📜user_repository_mock.go
┣ 📜.gitignore
┣ 📜Dockerfile
┣ 📜LICENSE
┣ 📜README.md
┣ 📜deployment.yaml
┣ 📜go.mod
┣ 📜go.sum
┣ 📜main.go
┗ 📜service.yaml
go mod downloadRun the application locally without Docker:
go run main.goFeel free to open issues or submit pull requests for any enhancements or bug fixes.
This project is licensed under the MIT License.
For questions or support, please reach out to:
- Email: tanvir6@gmail.com
- GitHub: tanvirislam06