You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-7
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,17 @@
2
2
3
3
[][quay-joshix-caddy]
4
4
5
-
This container image encapsulates a [*Caddy*][caddy] HTTP server. It is built `FROM` the [*scratch* image][scratchimg] and executes a single statically-linked `caddy` binary absent any non-standard[modules][caddons]. It includes a tiny `index.html` landing page so that it can be demonstrated without configuration on any Docker host by invoking e.g., `docker run -d -P joshix/caddy`.
5
+
This container image encapsulates a [*Caddy*][caddy] HTTP server. It is built `FROM` the [*scratch* image][scratchimg] and executes a statically-linked `caddy` binary with no added[modules][caddons]. It includes a tiny `index.html` landing page so that it can be demonstrated without configuration on any container host by invoking e.g., `docker run -d -P joshix/caddy`.
6
6
7
7
By default this caddy listens on the container's `EXPOSE`d TCP port #8080 and attempts to fulfill requests with files beneath the container's `/var/www/html/`.
8
8
9
-
Content should be added by binding a host volume over that path, or by `COPY`ing/`ADD`ing files there when `docker build`ing an image based on this one. Adding a `Caddyfile` through the same mechanisms allows configuration of the web server and sites as described in the [Caddy documentation][caddydocs].
9
+
Content should be added by binding a host volume over that path, or by `COPY`ing/`ADD`ing files there when building an image `FROM` this one. Adding a `Caddyfile` through the same mechanisms allows configuration of the web server and sites as described in the [Caddy documentation][caddydocs].
10
10
11
11
## Container File System
12
12
13
-
The file hierarchy beneath `./rootfs/`is`COPY`'d to the container's empty `/`, resulting in this layout:
13
+
The caddy binary produced by the build stage and the file tree beneath `./rootfs/`are`COPY`'d to the container's `/`, resulting in this file hierarchy in the container image:
14
14
15
-
*`/bin/caddy` - Server executable
15
+
*`/bin/caddy` - Server executable and container `ENTRYPOINT`
16
16
*`/var/www/html/` - Caddy working directory and root of HTTP name space
Caddy can [automatically acquire and renew TLS keys and certificates][caddyautotls] to secure connections using the *Let's Encrypt* project's ACME protocol. Because this container runs the `caddy` executable as an unprivileged user, it cannot bind privileged ports (port numbers < 1024) without further arrangement. This container is intended for use behind a container network like that provided by Docker or the Kubernetes CNI. Usually TLS termination would occur at the edge of the container host network rather than at the caddy HTTPd.
104
+
Caddy can [automatically acquire and renew TLS keys and certificates][caddyautotls] to secure connections using the *Let's Encrypt* project's ACME protocol. Because this container runs the `caddy` executable as an unprivileged user, it cannot bind privileged ports (port numbers < 1024) without further arrangement. This container is intended for use behind a container network like that provided by Docker or the Kubernetes CNI. Usually TLS termination happens at the edge of the container host network rather than at the HTTPd.
105
105
106
-
#### Caddyfile Required
106
+
##Cloning this repo
107
107
108
-
Create a Caddyfile specifying, at minimum, a domain name resolving to the docker host that will arrange for such traffic to be handled by the running caddybox container, and the email address for registration with letsencrypt.
108
+
Versions up to v2.6.2-cb.1 included a caddy binary built outside the container build process. While that is no longer true, and caddy is built in a multi-stage container build, this repo remains large with every previous version having a binary at `rootfs/bin/caddy`.
109
+
110
+
Work around this with git's shallow clone. This fetches only the given number of revisions. For most new clones of this repo, that number should be 1. Something like `git clone --depth 1 --branch multistage https://github.com/joshix/caddybox` should require only a small download and disk allocation.
109
111
110
112
## Building Caddy with xcaddy
111
113
114
+
Preserved for reference. The build is no longer done out-of-band and the caddy binary is no longer included in this container image source repo. Instead, the xcaddy build tool runs inside a first stage build container in a [multi-stage][multi-stage-build][Dockerfile][Dockerfile].
0 commit comments