Just another tiny, speedy webserver
Host your static frontend with speed.
(The code is based on the fasthttp fileserver example.)
This project provides a container that can be used to host static files like an angular, react or vue frontend very easily.
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.
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
docker run -d --name go-static -v $(pwd)/your-static-files:/static:ro fluktuid/go-static
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 |
This Project ist based on fasthttp so check their benchmarks for further information.