Fork of the https://github.com/PierreZ/goStatic with added features:
A really small static web server for Docker
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.
Yeah, decided to drop support of unsecured HTTPS. Two-years ago, when I started GoStatic, there was no automatic HTTPS available. Nowadays, thanks to Let's Encrypt, it's really easy to do so. If you need HTTPS, I recommend caddy.
Because the official Golang image is wayyyy to big (around 1/2Gb as you can see below) and could be unsecure.
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:
docker run -d -p 80:8043 -v path/to/website:/srv/http --name goStatic pierrezemb/gostatic
./goStatic --help
Usage of /goStatic:
-append-header HeaderName:Value
HTTP response header, specified as HeaderName:Value that should be added to all responses.
-context string
The 'context' path on which files are served, e.g. 'doc' will serve the files at 'http://localhost:<port>/doc/'
-default-user-basic-auth string
Define the user (default "gopher")
-enable-basic-auth
Enable basic auth. By default, password are randomly generated. Use --set-basic-auth to set it.
-fallback string
Default fallback file. Either absolute for a specific asset (/index.html), or relative to recursively resolve (index.html)
-password-length int
Size of the randomized password (default 16)
-path string
The path for the static files (default "/srv/http")
-port int
The listening port (default 8043)
-set-basic-auth string
Define the basic auth. Form must be user:password
-status-path string
Path to serve status JSON. Default is /status (default "/status")
-status-start-ts
Add start timestamp to the status
-status-vars string
<ENV_VAR>:<STATUS_VAR>,...
The fallback option is principally useful for single page applications (SPAs) where the browser may request a file, but where part of the path is in fact an internal route in the application, not a file on disk. goStatic supports two possible usages of this option:
The second case is useful if you have multiple SPAs within the one filesystem. e.g., / and /admin.
Content type
Image
Digest
Size
3.9 MB
Last updated
almost 7 years ago
docker pull mcgunn/gostatic