Template project to get started with a simple API skeleton in Go and Docker

Golang-Docker template

A template project to create a Docker image for a Go application. The example application exposes an HTTP endpoint through a REST API packaged as a static binary. View on Docker Hub or GitHub Container Registry.

Usage

Local development

This example project uses Docker Compose to build and run the example application.

docker-compose up --build -d
docker-compose logs -f

After a kick-start, you can access the application through the following URL: http://localhost:3000. You can test the application by running the following command:

curl http://localhost:3000

You can do a local development of the application by running the following command: go run main.go.

Remote development using GitHub Codespaces

GitHub Codespaces is a new feature in GitHub that allows you to run your code in a sandboxed environment on cloud. To run the project on GitHub Codespaces, follow these steps:

  1. Fork the repository.
  2. Click on the green Code button beside the Go to file and Add file buttons.
  3. Click on Codespaces in the dropdown menu and click New Codespace.
  4. Build will start automatically and you can run go run main.go to start the application.

Local development using Devcontainer

Devcontainer is a feature in Visual Studio Code that allows you to run and execute your code in a Docker container. To run the project on Devcontainer, follow these steps:

  1. Fork and clone the repository.
  2. Open the repository in Visual Studio Code and download the Devcontainer extension.
  3. Visual Studio Code will prompt you to open the folder in the Devcontainer.
  4. On clicking, Visual Studio Code will automatically start the container and you can run go run main.go to start the application.

Tools

The relevant tools for building, linting, and testing the application are used:

  1. Docker and Docker Compose for building and running the application.
  2. Pre-Commit for verifying the linting and formatting rules.
  3. Shellcheck for linting the Shell scripts.
  4. Make for controlling the build, linting, and testing processes.
  5. Hurl for end-to-end testing by running HTTP requests against the application.
  6. GitHub Actions for running the build, linting, and testing processes on CI/CD.
  7. Devcontainer for running the application on a Docker container for local development.
  8. GitHub Codespaces for running the application on GitHub Codespaces for remote development.

License

MIT

Owner
Harsh Mishra
Open Source @metacall, @moja-global, @quansight-labs @openshift • Community Lead @DSC-SIST • Web, DevOps and Blogging
Harsh Mishra
Similar Resources

Go structure annotations that supports encoding and decoding; similar to C-style bitfields. Supports bitfield packing, self-describing layout parameters, and alignment.

Go structure annotations that supports encoding and decoding; similar to C-style bitfields. Supports bitfield packing, self-describing layout parameters, and alignment.

STRUCTure EXtensions structex provides annotation rules that extend Go structures for implementation of encoding and decoding of byte backed data fram

Oct 13, 2022

Download, build, cache and run a Go app easily.

demand -- An easy way to install apps demand will download, build, cache and run a Go app. You can use it as an interpreter. Create a file bytes2human

Sep 10, 2017

A program to build, run, and restart a Go program on code change

devrun A program to build, run, and restart a Go program on code change. It also supports watching all your Go imports too. So if you change the code

Apr 4, 2022

Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.

  Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.

gore Yet another Go REPL that works nicely. Featured with line editing, code completion, and more. (Screencast taken with cho45/KeyCast) Usage gore Af

Jan 2, 2023

cmd tool for automatic storage and comparison of benchmarks results

prettybenchcmp prettybenchcmp is cmd tool for storage and comparison of benchmarks results. There is a standard tool benchcmp, but I don't think that

Apr 6, 2021

Will autobuild and kill/relaunch the target when you update the code.

Use like rerun github.com/skelterjohn/go.uik/uiktest Usage: rerun [--test] [--build] [--race] [--no-run] import path [arg]* For any go executable in

Jul 23, 2022

golang feature toggle library - a library to help make golang feature toggling clean and easy

toggle supports env_variable backed toggling. It can also be updated via a pubsub interface (tested w/ redis) 2 engines for toggle backing are include

Mar 29, 2022

Aegis is a library that allows you detect if your software is being debugged or not on Linux, FreeBSD, NetBSD, OpenBSD and Windows

Aegis is a library that allows you detect if your software is being debugged or not on Linux, FreeBSD, NetBSD, OpenBSD and Windows

Aegis is a library that allows you detect if your software is being debugged or not on Linux, FreeBSD, NetBSD, OpenBSD and Windows. You can use it natively from C or use the Go bind.

Aug 29, 2022

Go-basic-skeleton - Simple and basic skeleton for go projects

Go Bootstrap (base/skeleton) Introduction This is a repository intended to serve

Mar 16, 2022

Simple boilerplate code to get started with building and deploying a serverless CRUD API

Simple boilerplate code to get started with building and deploying a serverless CRUD API with Go, MongoDB and Netlify

Jan 20, 2022

A boiler-plate like base for people to get started in creating automation software specifically for purchasing items on websites.

Bot-Base Bot-Base is a small project with concepts for most elements of a bot. Feel free to contact me on Twitter with any questions. Contributing Pul

Dec 27, 2022

Go-project-template - Template for a golang project

This is a template repository for golang project Usage Go to github: https://git

Oct 25, 2022

Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development

Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development

Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development There is no doubt that Golang’s good documentation and intellige

Dec 31, 2022

A getting-started project based on asynq.

README QuickStart Make sure Redis run on localhost:6379. cd workers && go run workers.go cd client && go run client.go We can run client.go first the

Apr 2, 2022

SizedWaitGroup has the same role and close to the same API as the Golang sync.WaitGroup but it adds a limit on the amount of goroutines started concurrently.

SizedWaitGroup SizedWaitGroup has the same role and API as sync.WaitGroup but it adds a limit of the amount of goroutines started concurrently. SizedW

Jan 8, 2023

Api-go-template - A simple Go API template that uses a controller-service based model to build its routes

api-go-template This is a simple Go API template that uses a controller-service

Feb 18, 2022

An app skeleton for very simple golang web applications

Golang App Skeleton This is a skeleton for a golang web application optimized for simplicity and rapid development. Prerequisites Go 1.15 or greater O

Oct 16, 2022

Go Getting Started from PluralSight. Simple webapp in golang

Go_WEB_APP Go Getting Started from PluralSight. Simple webapp in golang This is simple Webapp in GO, which has users api to interact with backend This

Oct 18, 2021

Generates a simple skeleton directory structure for go/gin/bootstrap web apps

Gin Bootstrap Initializer Generates a simple skeleton directory structure for go/gin/bootstrap web apps Description This package handles building a co

Jan 21, 2022
go/template is a tool for jumpstarting production-ready Golang projects quickly.
go/template is a tool for jumpstarting production-ready Golang projects quickly.

go/template go/template provides a blueprint for production-ready Go project layouts. Credit to Renée French for the Go Gopher logo Credit to Go Autho

Dec 24, 2022
Docker-compose files for running full Storj network locally

docker-compose based Storj environment storj-up is a swiss-army tool to create / customize Storj clusters with the help of docker-compose (not just st

Nov 16, 2022
ide-gen is a tool for development workspace prepare automation by automatic VCS repositories discovery and clone and project generation for supported IDEs.

ide-gen is a tool for development workspace prepare automation by automatic VCS repositories discovery and clone and project generation for supported IDEs.

May 8, 2022
NoColor — validate the architecture of your PHP project
 NoColor — validate the architecture of your PHP project

NoColor is an architecture validation tool based on the concept of colored functions. This concept was originally invented for KPHP and later exposed as a separate tool to be used in regular PHP projects.

Nov 28, 2022
A simple application to show how to use dd-trace-go's tracer and profiler.

dd-trace-go-demo A simple application to show how to use dd-trace-go's tracer and profiler. Usage To run this demo application, simply clone this repo

Oct 8, 2022
GAPID: Graphics API Debugger
GAPID: Graphics API Debugger

GAPID: Graphics API Debugger

Dec 24, 2022
Automatically generate RESTful API documentation with Swagger 2.0 for Go.
Automatically generate RESTful API documentation with Swagger 2.0 for Go.

Automatically generate RESTful API documentation with Swagger 2.0 for Go.

Jan 9, 2023
LiteIDE is a simple, open source, cross-platform Go IDE.
LiteIDE is a simple, open source, cross-platform Go IDE.

LiteIDE X Introduction LiteIDE is a simple, open source, cross-platform Go IDE. Version: X37.3 (support Go modules) Author: visualfc Features Core fea

Jan 5, 2023
A simple go app that can show users' cursors in real-time

ws-cursors Description A simple go app that can show users' cursors in real-time. Instance The real service is available on Heroku by address - https:

Jan 26, 2022
Simple tool that updates Visual Studio Code workspace(s) to include Go modules in gopath/src, then launches VSCode if only one modified.

Simple tool that updates Visual Studio Code workspace(s) to include Go modules in gopath/src, then launches VSCode if only one modified.

Jan 27, 2022