Sign inSign up

jumanjiman/caddy

By jumanjiman

Updated over 5 years ago

https://github.com/mholt/caddy web server in a tiny docker container based on alpine linux

Image
7

10K+

jumanjiman/caddy repository overview

Caddy web server

Download size Version Source code Docker Registry  Circle CI

This project: https://github.com/jumanjihouse/docker-caddy/ Docker image: https://registry.hub.docker.com/u/jumanjiman/caddy/ Upstream Caddy: https://github.com/mholt/caddy

About

This git repo downloads golang source code from https://github.com/mholt/caddy and builds a small docker image.

See http://blog.gopheracademy.com/caddy-a-look-inside/ and https://caddyserver.com/ to learn about Caddy.

Plugins

The following plugins are installed in the image:

See fixtures/caddyfile for an example config used to test this image.

License

See LICENSE.md in this git repo.

How-to

Build

:warning: Build requires Docker 1.9.0 or later (for docker build args).

make all

The above command builds a caddybuild image, which builds a static binary. It then copies the static binary out of the build image and creates a runtime image, caddy.

The runtime image does not have developer tools or source code. The runtime image is based on Alpine, not Scratch, to enable plugins that depend on external tools, such as git.

Test

We use circleci to build, test, and publish the image to Docker hub. We use BATS to run the test harness.

Output of make test resembles:

✓ caddy image exists
✓ caddy is running on the test port
✓ git plugin is installed
✓ git plugin works
✓ caddy binary is stripped
✓ caddy binary is statically compiled
✓ upload plugin is present
✓ upload works

8 tests, 0 failures
Pull an already-built image
# Note: build tags follow the pattern
# jumanjiman/caddy:${CADDY_VERSION}-${BUILD_DATE}T${BUILD_TIME}-git-${HASH}
docker pull jumanjiman/caddy
View labels

Each built image has labels that generally follow http://label-schema.org/

We add a label, ci-build-url, that is not currently part of the schema. This extra label provides a permanent link to the CI build for the image.

View the ci-build-url label on a built image:

docker inspect \
  -f '{{ index .Config.Labels "io.github.jumanjiman.ci-build-url" }}' \
  jumanjiman/caddy

Query all the labels inside a built image:

docker inspect jumanjiman/caddy | jq -M '.[].Config.Labels'
Run

Create a config in some directory on your host, then:

docker run -d \
-p 2020:2020 \
--name caddy \
-v /path/to/configdir:/etc/caddy \
--read-only \
--cap-drop all \
jumanjiman/caddy -conf /etc/caddy/caddyfile

Tag summary

Content type

Image

Digest

sha256:c099209c2

Size

16 MB

Last updated

over 5 years ago

docker pull jumanjiman/caddy