- 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" }
- 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.
- The default port is 8765
- The http service port can be overwritten by setting the HTTP_PORT environment variable
HTTP_PORT=8765
- 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
- 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
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/