From e8cf230117fced743199d590057d02f84f5bef53 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Sat, 3 Feb 2024 17:47:14 +0300 Subject: [PATCH] address feedback --- src/docs/markdown/build.md | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/src/docs/markdown/build.md b/src/docs/markdown/build.md index 4002d11..9fb9449 100644 --- a/src/docs/markdown/build.md +++ b/src/docs/markdown/build.md @@ -4,10 +4,10 @@ title: "Build from source" # Build from source -There are 2 ways to build Caddy, as opposed to installation of pre-built executable: -- Build from Git repo -- Build using `xcaddy` -- Build custom Docker image +There are 2 ways to build Caddy if you need to customize Caddy: +- [Git](#git): Build from Git repo +- [`xcaddy`](#xcaddy): Build using `xcaddy` +- [Docker](#docker) Build custom Docker image Requirements: @@ -15,7 +15,7 @@ Requirements: The [last section](#package-support-files-for-custom-builds-for-debianubunturaspbian) contains instructions for users who installed Caddy using the APT command on Debian-derivative system yet need the custom build executable for their operations. -## Build from Git repo +## Git Requirements: @@ -49,7 +49,7 @@ Or similarly for Linux ARMv6 when you're not on Linux or on ARMv6:
GOOS=linux GOARCH=arm GOARM=6 go build
-## Build using `xcaddy` +## xcaddy The [`xcaddy` command](https://github.com/caddyserver/xcaddy) is the easiest way to build Caddy with version information and/or plugins. @@ -76,23 +76,9 @@ Cross-platform compilation with `xcaddy` works the same as with the `go` command
GOOS=darwin xcaddy build
-## Build Custom Docker Image +## Docker -Most users deploying production sites will not want to rely on mounting files into a container, but will instead base their own images on `caddy`: - -```Dockerfile -# note: never use the :latest tag in a production site -FROM caddy: - -COPY Caddyfile /etc/caddy/Caddyfile -COPY site /srv -``` - -#### Adding custom Caddy modules - -Caddy is extendable through the use of "modules". See https://caddyserver.com/docs/extending-caddy for full details. You can find a list of available modules on [the Caddy website's download page](https://caddyserver.com/download). - -You can use the `:builder` image as a short-cut to building a new Caddy binary: +You can use the `:builder` image as a short-cut to building a new Caddy binary with custom modules: ```Dockerfile FROM caddy:-builder AS builder @@ -108,9 +94,7 @@ COPY --from=builder /usr/bin/caddy /usr/bin/caddy Note the second `FROM` instruction - this produces a much smaller image by simply overlaying the newly-built binary on top of the regular `caddy` image. -The [`xcaddy`](https://caddyserver.com/docs/build#xcaddy) tool is used to [build a new Caddy entrypoint](https://github.com/caddyserver/caddy/blob/4217217badf220d7d2c25f43f955fdc8454f2c64/cmd/caddy/main.go#L15..L25), with the provided modules. You can specify just a module name, or a name with a version (separated by `@`). You can also specify a specific version (can be a version tag or commit hash) of Caddy to build from. Read more about [`xcaddy` usage](https://github.com/caddyserver/xcaddy#command-usage). - -Note that the "standard" Caddy modules ([`github.com/caddyserver/caddy/master/modules/standard`](https://github.com/caddyserver/caddy/tree/master/modules/standard)) are always included. +The builder uses `xcaddy` to Caddy with the provided modules, similar to the process outlined in the [`xcaddy`](#xcaddy) section. ## Package support files for custom builds for Debian/Ubuntu/Raspbian