grim/goserve

About

goserve is a dead simple HTTP server whose sole purpose is to serve static content from a container.

This was built because I was tired of introducing nginx or another web server into what would be a tiny container only containing the static files themselves.

Building

If you're building this yourself, it is recommended to build it statically and strip the resulting binary with the following command.

CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static" -s' .

Configuration

goserve is configurable via environment variables

  • GOSERVE_404_PAGE an optional custom html file for the 404 page
  • GOSERVE_ADDR the address it listen on (defaults to :3000)
  • GOSERVE_PREFIX a optional prefix to strip from the path, useful if using path based virtual hosts
  • GOSERVE_ROOT the root directory of the files to serve (defaults to html/)
Recent Changes
Tags
Branches
Bookmarks