From 6acfaecb2402719b8fce5b4675e6b50d5d7c4002 Mon Sep 17 00:00:00 2001 From: PierreZ Date: Sun, 19 Jul 2015 15:37:42 +0200 Subject: [PATCH] fixing readme and adding some comments --- README.md | 11 +++++++++-- main.go | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad11fb9..9c26a38 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ # goStatic A really small static web server for Docker +![DockerHub](http://dockeri.co/image/pierrezemb/gostatic) + +[![](https://badge.imagelayers.io/pierrezemb/gostatic:latest.svg)](https://imagelayers.io/?images=pierrezemb/gostatic:latest 'Get your own badge on imagelayers.io') +[![GoDoc](https://godoc.org/github.com/PierreZ/goStatic?status.svg)](https://godoc.org/github.com/PierreZ/goStatic) + ### The goal My goal is to create to smallest docker container for my web static files. The advantage of Go is that you can generate a fully static binary, so that you don't need anything else. ### Features + * A fully static web server in 5MB * Web server build for Docker * HTTPS by default * Can generate certificate on his onw @@ -19,6 +25,7 @@ Because the official Golang image is wayyyy to big (around 1/2Gb as you can see For me, the whole point of containers is to have a light container... Many links should provide you with additionnal info to see my point of view: + * [Over 30% of Official Images in Docker Hub Contain High Priority Security Vulnerabilities](http://www.banyanops.com/blog/analyzing-docker-hub/) * [Create The Smallest Possible Docker Container](http://blog.xebia.com/2014/07/04/create-the-smallest-possible-docker-container/) * [Building Docker Images for Static Go Binaries](https://medium.com/@kelseyhightower/optimizing-docker-images-for-static-binaries-b5696e26eb07) @@ -27,9 +34,9 @@ Many links should provide you with additionnal info to see my point of view: ### How to use ``` // HTTPS server -docker run -d -p 443:8043 -v path/to/website:/srv/http pierrezemb/goStatic +docker run -d -p 443:8043 -v path/to/website:/srv/http --name goStatic pierrezemb/gostatic // HTTP server -docker run -d -p 80:8043 -v path/to/website:/srv/http pierrezemb/goStatic --forceHTTP +docker run -d -p 80:8043 -v path/to/website:/srv/http --name goStatic pierrezemb/gostatic --forceHTTP ``` ### Wow, such container! What are you using? diff --git a/main.go b/main.go index 91eeac1..2e4faa4 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,6 @@ +// This small program is just a small web server created in static mode +// in order to provide the smallest docker image possible + package main // import "github.com/PierreZ/goStatic" import ( @@ -23,7 +26,7 @@ import ( ) var ( - // Def & parsing of flags + // Def of flags portPtr = flag.Int("p", 8043, "The listening port") pathPtr = flag.String("static", "/srv/http", "The path for the static files") crtPtr = flag.String("crt", "/etc/ssl/server", "Folder for server.pem and key.pem")