yobasystems / alpine-caddy

Caddy running on Alpine Linux [Docker]
https://hub.docker.com/r/yobasystems/alpine-caddy/
21 stars 4 forks source link
alpine amd64 arm64 armhf caddy caddyfile docker docker-image dockerfile php yobasystems

Caddy container image running on Alpine Linux

Docker Automated build Docker Pulls Docker Stars

Alpine Version Caddy Version

This container image (yobasystems/alpine-caddy) is based on the minimal Alpine Linux using the Caddy HTTP/2 web server with HTTPS.

Alpine Version 3.20.2 (Released 2024-07-22)

Caddy Version 2.8.4

Table of Contents

πŸ”οΈ What is Alpine Linux?

Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications. Read more about Alpine Linux here and you can see how their mantra fits in right at home with Container images.

What is Caddy?

Caddy, sometimes clarified as the Caddy web server, is an open source, HTTP/2-enabled web server written in Go. It uses the Go standard library for its HTTP functionality. One of Caddy's most notable features is enabling HTTPS by default.

✨ Features

πŸ—οΈ Architectures

πŸ“ PLEASE CHECK TAGS BELOW FOR SUPPORTED ARCHITECTURES, THE ABOVE IS A LIST OF EXPLANATION

🏷️ Tags

πŸ“ Layers & Sizes

Version MicroBadger Layers (tag) MicroBadger Size (tag)

Version MicroBadger Layers (tag) MicroBadger Size (tag)

Version MicroBadger Layers (tag) MicroBadger Size (tag)

πŸš€ How to use this image

Environment Variables:

Main Caddy parameters:

Creating an instance

$ docker run -d --name examplecaddy -p 2015:2015 yobasystems/alpine-caddy

Point your browser to http://host-ip:2015.

PHP

:[<version>-]php variant of this image bundles PHP-FPM. e.g. :php, :0.11.0-php

$ docker run -d --name examplecaddy -p 2015:2015 yobasystems/alpine-caddy:php

Point your browser to http://host-ip:2015 and you will see a php info page.

Local php source

Replace /path/to/php/src with your php sources directory.

$ docker run -d --name examplecaddy -v /path/to/php/src:/srv -p 2015:2015 yobasystems/alpine-caddy:php

Point your browser to http://host-ip:2015.

Note

Your Caddyfile must include the line startup php-fpm. For Caddy to be PID 1 in the container, php-fpm could not be started.

Using git sources

Caddy can serve sites from git repository using git middleware.

Create Caddyfile

Replace github.com/team/repo with your repository.

$ printf "0.0.0.0\ngit github.com/team/repo" > Caddyfile
Run the image
$ docker run -d --name examplecaddy -v $(pwd)/Caddyfile:/etc/Caddyfile -p 2015:2015 yobasystems/alpine-caddy

Point your browser to http://host-ip:2015.

Usage

Default Caddyfile

The image contains a default Caddyfile.

0.0.0.0
browse
fastcgi / 127.0.0.1:9000 php # php variant only
startup php-fpm # php variant only

Note the last 2 lines are only present in the php variant.

Paths in container

Caddyfile: /etc/Caddyfile

Sites root: /srv

Using local Caddyfile and sites root

Replace /path/to/Caddyfile and /path/to/sites/root accordingly.

$ docker run -d --name examplecaddy -v /path/to/sites/root:/srv -v path/to/Caddyfile:/etc/Caddyfile -p 2015:2015 yobasystems/alpine-caddy

Let's Encrypt Auto SSL

Note that this does not work on local environments, the domain also has to resolve to the server requesting the certificate.

Use a valid domain and add email to your Caddyfile to avoid prompt at runtime. Replace example.co.uk with your domain and user@example.co.uk with your email.

example.co.uk
tls user@example.co.uk
Run the image

You can change the the ports if ports 80 and 443 are not available on host. e.g. 81:80, 444:443

$ docker run -d --name examplecaddy -v $(pwd)/Caddyfile:/etc/Caddyfile -p 80:80 -p 443:443 yobasystems/alpine-caddy

Optional but advised. Save certificates on host machine to prevent regeneration every time container starts. Let's Encrypts RATE LIMITS explain the number of times you can regenerate certificates.

$ docker run -d -v $(pwd)/Caddyfile:/etc/Caddyfile -v $HOME/.caddy:/root/.caddy -p 80:80 -p 443:443 yobasystems/alpine-caddy

πŸ” Image contents & Vulnerability analysis

PACKAGE NAME PACKAGE VERSION VULNERABILITIES

πŸ“š Source Repositories

🐳 Container Registries

πŸ”— Links

πŸ’° Donation

BMAC

BITCOIN

ETHEREUM