abhin4v / hastatic

hastatic is a tiny static content web server for Docker
BSD 3-Clause "New" or "Revised" License
69 stars 5 forks source link
docker docker-web-server haskell http-server static-server tiny-web-server

hastatic

Docker Build Status Docker Pulls MicroBadger Size

hastatic is a very small web server for serving static files from a Docker container.

Features

Usage

Create a Dockerfile for your website, deriving from abhin4v/hastatic:

FROM abhin4v/hastatic:latest

COPY mywebsite /opt/mywebsite
WORKDIR /opt/mywebsite
CMD ["/usr/bin/hastatic"]

Build and run:

$ docker build -t mywebsite .
$ # run with default configs
$ docker run -p 8080:3000 mywebsite
$ # run with custom configs
$ docker run -e PORT=2000 -e NF_FILE=404.html -e IDX_FILE=index.html -p 8080:2000 mywebsite
$ # run with HTTPS support
$ docker run -e TLS_CERT_FILE=certificate.pem -e TLS_KEY_FILE=key.pem -p 443:3000 mywebsite

Configuration

The Docker image supports these environment variable for configuration:

Internals

hastatic is written in Haskell, just 70 lines of it. It uses the excellent Warp server underneath with the warp-tls package for HTTPS support.