fixing readme and adding some comments

This commit is contained in:
PierreZ 2015-07-19 15:37:42 +02:00
parent 60df40beb9
commit 6acfaecb24
2 changed files with 13 additions and 3 deletions

View file

@ -1,10 +1,16 @@
# goStatic # goStatic
A really small static web server for Docker 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 ### 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. 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 ### Features
* A fully static web server in 5MB
* Web server build for Docker * Web server build for Docker
* HTTPS by default * HTTPS by default
* Can generate certificate on his onw * 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... 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: 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/) * [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/) * [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) * [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 ### How to use
``` ```
// HTTPS server // 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 // 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? ### Wow, such container! What are you using?

View file

@ -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" package main // import "github.com/PierreZ/goStatic"
import ( import (
@ -23,7 +26,7 @@ import (
) )
var ( var (
// Def & parsing of flags // Def of flags
portPtr = flag.Int("p", 8043, "The listening port") portPtr = flag.Int("p", 8043, "The listening port")
pathPtr = flag.String("static", "/srv/http", "The path for the static files") 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") crtPtr = flag.String("crt", "/etc/ssl/server", "Folder for server.pem and key.pem")