This program will start a http server listen to localhost:8080 and display Hello World in the index page.
git clone https://github.com/wei0831/golang-simplehttp.git
cd golang-simplehttp
go run main.go
Open localhost:8080
in your browser.
docker run -it -p 8080:8080 --rm wei0831/golang-simplehttp
Open localhost:8080
in your browser.
The image created will result aroud 700MB. The app is compiled inside the container with Go installed and all the depenencies.
The image created will result around 6MB. We need to compile the app first ourselves then add into the container.