Skip to content

Boilerplate for containerized Go applications including logging configuration, CI, Kubernetes resources and more

Notifications You must be signed in to change notification settings

ashkan-pm/go-boilerplate

Repository files navigation

Go Boilerplate

Boilerplate for containerized Go applications including logging configuration, CI, Kubernetes resources and more

Features

  • 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

Quick Start

  1. Clone the project
git clone https://github.com/ashkan-pm/go-boilerplate
  1. Install dependencies
make install
  1. Run the application
make run
  1. You can curl the health-check to make sure everything is good
curl -v localhost:8080

Docker

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

Kubernetes

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

About

Boilerplate for containerized Go applications including logging configuration, CI, Kubernetes resources and more

Topics

Resources

Stars

Watchers

Forks