Skip to content

DevoKun/hello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello

  • A simple http server, written in go.
  • Requests can be sent using GET, POST, PUT, et. al.
  • Requests can be sent to ANY URL.
  • This service will always return the json string: { "hello": "world" }

Why?

  • There are MANY very similar services available to be run from docker containers.
  • When I was pulling one of them, I was stunned how large the container was and that only a few urls were supported.
  • This little hello container is not meant to impress, but to be small, quick to pull, easy to use, and serve well when a test web service is needed.

HTTP Service Port

  • The default port is 8765
  • The http service port can be overwritten by setting the HTTP_PORT environment variable
HTTP_PORT=8765

Build

Application

  • Ensure golang is installed
  • Run build.sh
  • build.sh will produce binaries in the target directory which can be run on multiple platforms.
./build.sh
Building darwin-amd64
Building linux-amd64
Building windows-amd64

tree target
target
├── hello-darwin-amd64
├── hello-linux-amd64
└── hello-windows-amd64.exe

Docker Image

  • Ensure docker is installed
  • The build_docker.sh script will build the docker image.
  • Build the docker image after building the application.
  • To push to the Docker Registry, set the PUSH_TO_REGISTRY environment variable to true.
PUSH_TO_REGISTRY=true ./build_docker.sh

Using the Docker Container

docker pull devokun/hello

docker run -d --name hello -p 3000:3000 -e "HTTP_PORT=3000" devokun/hello

curl http://0.0.0.0:3000/

About

A simple http service that displays hello world whether you send an http GET, POST, PUT, etc. and no matter the url requested.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published