chore: added docs for new flags, formatted the docs a little bit

This commit is contained in:
parsec 2023-03-16 22:04:12 -04:00
parent d89de33d06
commit c41a07c44d

View file

@ -1,7 +1,9 @@
# goStatic [![Docker Pulls](https://img.shields.io/docker/pulls/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Docker Build](https://img.shields.io/docker/build/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Build Status](https://travis-ci.org/PierreZ/goStatic.svg?branch=master)](https://travis-ci.org/PierreZ/goStatic) [![GoDoc](https://godoc.org/github.com/PierreZ/goStatic?status.svg)](https://godoc.org/github.com/PierreZ/goStatic) # goStatic [![Docker Pulls](https://img.shields.io/docker/pulls/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Docker Build](https://img.shields.io/docker/build/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Build Status](https://travis-ci.org/PierreZ/goStatic.svg?branch=master)](https://travis-ci.org/PierreZ/goStatic) [![GoDoc](https://godoc.org/github.com/PierreZ/goStatic?status.svg)](https://godoc.org/github.com/PierreZ/goStatic)
A really small, multi-arch, static web server for Docker A really small, multi-arch, static web server for Docker
## 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.
### Wait, I've been using old versions of GoStatic and things have changed! ### Wait, I've been using old versions of GoStatic and things have changed!
@ -9,6 +11,7 @@ My goal is to create to smallest docker container for my web static files. The a
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](https://caddyserver.com). 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](https://caddyserver.com).
## Features ## Features
* A fully static web server embedded in a `SCRATCH` image * A fully static web server embedded in a `SCRATCH` image
* No framework * No framework
* Web server built for Docker * Web server built for Docker
@ -18,6 +21,7 @@ Yeah, decided to drop support of unsecured HTTPS. Two-years ago, when I started
* Specify custom response headers per path and filetype [(info)](./docs/header-config.md) * Specify custom response headers per path and filetype [(info)](./docs/header-config.md)
## Why? ## Why?
Because the official Golang image is wayyyy too big (around 1/2Gb as you can see below) and could be insecure. Because the official Golang image is wayyyy too big (around 1/2Gb as you can see below) and could be insecure.
[![](https://badge.imagelayers.io/golang:latest.svg)](https://imagelayers.io/?images=golang:latest 'Get your own badge on imagelayers.io') [![](https://badge.imagelayers.io/golang:latest.svg)](https://imagelayers.io/?images=golang:latest 'Get your own badge on imagelayers.io')
@ -31,13 +35,14 @@ Many links should provide you with additional info to see my point of view:
* [Small Docker Images For Go Apps](https://www.ctl.io/developers/blog/post/small-docker-images-for-go-apps) * [Small Docker Images For Go Apps](https://www.ctl.io/developers/blog/post/small-docker-images-for-go-apps)
## How to use ## How to use
```
```bash
docker run -d -p 80:8043 -v path/to/website:/srv/http --name goStatic pierrezemb/gostatic docker run -d -p 80:8043 -v path/to/website:/srv/http --name goStatic pierrezemb/gostatic
``` ```
## Usage ## Usage
``` ```bash
./goStatic --help ./goStatic --help
Usage of ./goStatic: Usage of ./goStatic:
-append-header HeaderName:Value -append-header HeaderName:Value
@ -65,7 +70,11 @@ Usage of ./goStatic:
-port int -port int
The listening port (default 8043) The listening port (default 8043)
-set-basic-auth string -set-basic-auth string
Define the basic auth. Form must be user:password Define the basic auth user string. Form must be user:password
-basic-auth-user
Define the basic auth username
-basic-auth-pass
Define the basic auth password
``` ```
### Fallback ### Fallback
@ -77,10 +86,10 @@ The fallback option is principally useful for single-page applications (SPAs) wh
The second case is useful if you have multiple SPAs within the one filesystem. e.g., */* and */admin*. The second case is useful if you have multiple SPAs within the one filesystem. e.g., */* and */admin*.
## Build ## Build
### Docker images ### Docker images
```bash ```bash
docker buildx create --use --name=cross docker buildx create --use --name=cross
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v5,linux/arm/v6,linux/arm/v7,darwin/amd64,darwin/arm64,windows/amd64 . docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v5,linux/arm/v6,linux/arm/v7,darwin/amd64,darwin/arm64,windows/amd64 .