A simple lighttpd image that doesn't use an entrypoint script.
docker build -t pdok/lighttpd .
docker run --rm -d -v `pwd`/www/:/var/www -p 80:80 --name lighttpd-example pdok/lighttpd
docker stop lighttpd-example
This project aims to fulfill the need in creating a lighttpd container that is deployable on a scalable infrastructure, like Kubernetes. This means that this image is based on a lightweight base-image.
The image comes with a default, overridable lighttdp.conf
file that is specifically aimed at serving static files for a web application. The default configuration comes with:
mod_expire
: Sets Cache-Control headers on files with hashed filenames likeindex.561ecd9f.css
mod_deflate
: Output compression on html, text, css, javascript and xml files, the compressed files are stored in a cache directory
When running this image on Kubernetes and serving out very large files that will be compressed, ensure that the cache directory has it's own volume mount. For most webapps this will not be necessary.
It will start a small container containing lighttpd.
docker build -t pdok/lighttpd .
Run the following from the root of the repository to enable Dockerfile linting with hadolint:
git config --local include.path ../.gitconfig
Successful Dockerfile linting is a requirement for merging pull requests into master, which is enforced with the Dockerfile Lint Github action.
This image can be run straight from the commandline. Both the default configuration file and the default asset directory can be overridden from the commandline:
- override default configuration file by mounting a directory with a
lighttpd.conf
file at/srv/lighttpd
in the container - override default asset directory by mounting a directory with assets to serve at
/var/www
in the container
docker run --rm -p 80:80 --name lighttpd-example -v `pwd`/config:/srv/lighttpd -v `pwd`/www:/var/www pdok/lighttpd
Running the example above will create a service on the url http://localhost/
The environment variables that can be set are the following:
DEBUG
MIN_PROCS
MAX_PROCS
MAX_LOAD_PER_PROC
IDLE_TIMEOUT
The environment variables have a default value set in the Dockerfile.
See below example for how to use this image to build another image to serve out static files:
work_dir="/tmp/$(uuidgen)"
mkdir "$work_dir"
cd "$work_dir"
echo "<h1>TEST</h1>" > index.html
cat > Dockerfile << EOF
FROM pdok/lighttpd
COPY index.html /var/www/index.html
EOF
docker build -t pdok/lighttpd-test .
docker run -p 80:80 pdok/lighttpd-test
Make a pull request...
Contacting the maintainers can be done through the issue tracker.