Boilerplate for containerized Go applications including logging configuration, CI, Kubernetes resources and more
- CI pipeline using Github Actions covering lint, test and build
- Multi-stage Dockerfile optimized for cache and minimal image size
- Example Kubernetes deployment file
- Custom logger configuration supporting rolling log files and pretty logging on console using zerolog
- HTTP health-check server
- Dotenv support
- Convenient
Makefile
shell commands
- Clone the project
git clone https://github.com/ashkan-pm/go-boilerplate
- Install dependencies
make install
- Run the application
make run
- You can
curl
the health-check to make sure everything is good
curl -v localhost:8080
You can build the image by running the command below in the root of the repository
docker build . -t go-boilerplate
You can also run the container and expose the HTTP port by running
docker run --env ENV=production --publish 8080:8080 go-boilerplate
Just replace the APP_
prefixed values in go-boilerplate.deployment.yaml and apply on your Kubernetes cluster using
kubectl apply -f go-boilerplate.deployment.yaml