Skip to content

An ultra-fast, tiny go-based webserver for hosting static content

License

Notifications You must be signed in to change notification settings

fluktuid/go-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Static

Just another tiny, speedy webserver
Host your static frontend with speed.

(The code is based on the fasthttp fileserver example.)

But Why?

This project provides a container that can be used to host static files like an angular, react or vue frontend very easily.

But How?

There are basically two ways to use this image. Either you build your own image (preferred) or you mount the static files into a running container.

Build your own Image

FROM ghcr.io/fluktuid/go-static/go-static:1.0.2
# or use the docker hub registry: FROM fluktuid/go-static:1.0.2
LABEL maintainer="yourname <yourmail>"

COPY ./your-static-files /static

Mount your Files

docker run -d --name go-static -v $(pwd)/your-static-files:/static:ro fluktuid/go-static

I need more configuration

Of course, a more precise configuration of the service is also possible. There are different values that can be configured via environment variables:

env var description default
ADDR TCP address to listen to :8080
ADDR_TLS TCP address to listen to TLS (aka SSL or HTTPS) requests. Leave empty for disabling TLS ""
BYTE_RANGE Enables byte range requests if set to true false
CERT_FILE Path to TLS certificate file ssl-cert.pem
COMPRESS Enables transparent response compression if set to true false
DIR Directory to serve static files from /static
GENERATE_INDEX_PAGES Whether to generate directory index pages true
KEY_FILE Path to TLS key file ./ssl-cert.key
VHOST Enables virtual hosting by prepending the requested path with the requested hostname false

But how fast

This Project ist based on fasthttp so check their benchmarks for further information.