├── .github ├── dependabot.yml ├── dependabot.yml.tmpl └── workflows │ └── docker.yml ├── .gitignore ├── 2.10 ├── alpine │ ├── Dockerfile │ └── Dockerfile.base ├── builder │ ├── Caddyfile │ ├── Dockerfile │ ├── Dockerfile.base │ └── caddy-builder.sh ├── windows-builder │ ├── ltsc2022 │ │ ├── Dockerfile │ │ └── Dockerfile.base │ └── ltsc2025 │ │ ├── Dockerfile │ │ └── Dockerfile.base └── windows │ ├── ltsc2022 │ ├── Dockerfile │ └── Dockerfile.base │ └── ltsc2025 │ ├── Dockerfile │ └── Dockerfile.base ├── Dockerfile.builder.tmpl ├── Dockerfile.tmpl ├── Dockerfile.windows-builder.tmpl ├── Dockerfile.windows.tmpl ├── LICENSE ├── Makefile ├── README.md ├── caddy-builder.sh.tmpl ├── fileCommit.sh ├── getChecksums.sh ├── hooks └── build ├── library └── caddy ├── render-dockerfiles.tmpl ├── stackbrew-config.yaml └── stackbrew.tmpl /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: docker 4 | directory: "/2.10/alpine" 5 | schedule: 6 | interval: daily 7 | time: "02:00" 8 | timezone: Etc/UTC 9 | open-pull-requests-limit: 10 10 | - package-ecosystem: docker 11 | directory: "/2.10/builder" 12 | schedule: 13 | interval: daily 14 | time: "02:00" 15 | timezone: Etc/UTC 16 | open-pull-requests-limit: 10 17 | - package-ecosystem: docker 18 | directory: "/2.10/windows/ltsc2022" 19 | schedule: 20 | interval: daily 21 | time: "02:00" 22 | timezone: Etc/UTC 23 | open-pull-requests-limit: 10 24 | - package-ecosystem: docker 25 | directory: "/2.10/windows/ltsc2025" 26 | schedule: 27 | interval: daily 28 | time: "02:00" 29 | timezone: Etc/UTC 30 | open-pull-requests-limit: 10 31 | - package-ecosystem: docker 32 | directory: "/2.10/windows-builder/ltsc2022" 33 | schedule: 34 | interval: daily 35 | time: "02:00" 36 | timezone: Etc/UTC 37 | open-pull-requests-limit: 10 38 | - package-ecosystem: docker 39 | directory: "/2.10/windows-builder/ltsc2025" 40 | schedule: 41 | interval: daily 42 | time: "02:00" 43 | timezone: Etc/UTC 44 | open-pull-requests-limit: 10 45 | -------------------------------------------------------------------------------- /.github/dependabot.yml.tmpl: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | {{- range file.Walk "." }}{{ if and (file.IsDir .) (file.Exists (filepath.Join . "Dockerfile.base")) }} 4 | - package-ecosystem: docker 5 | directory: "/{{ . }}" 6 | schedule: 7 | interval: daily 8 | time: "02:00" 9 | timezone: Etc/UTC 10 | open-pull-requests-limit: 10 11 | {{- end }}{{ end }} 12 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker Build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | 8 | jobs: 9 | docker-linux-build: 10 | runs-on: ubuntu-latest 11 | container: 12 | image: hairyhenderson/dockerfiles-builder:latest 13 | env: 14 | BASHBREW_LIBRARY: ./library 15 | BASHBREW_NAMESPACE: caddy 16 | DOCKER_BUILDKIT: '1' 17 | steps: 18 | - uses: actions/checkout@master 19 | - name: non-master build test 20 | run: | 21 | docker build -f 2.10/alpine/Dockerfile 2.10/alpine 22 | docker build -f 2.10/builder/Dockerfile 2.10/builder 23 | if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master' 24 | - name: build 25 | run: bashbrew build caddy 26 | - name: push 27 | # NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/caddyserver/caddy-docker/settings 28 | # the user must have permission to push to https://hub.docker.com/r/caddy/caddy 29 | run: | 30 | echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin 31 | bashbrew push caddy 32 | if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master' 33 | - name: push (non-master dry run) 34 | run: | 35 | bashbrew push --dry-run caddy 36 | if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master' 37 | 38 | docker-windows-build: 39 | runs-on: windows-2022 40 | # env: 41 | # BASHBREW_LIBRARY: ./library 42 | # BASHBREW_NAMESPACE: caddy 43 | steps: 44 | - uses: actions/checkout@master 45 | - name: non-master build test 46 | run: | 47 | docker build -f 2.10/windows/ltsc2022/Dockerfile 2.10/windows/ltsc2022 48 | if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master' 49 | - name: install bashbrew 50 | run: curl -o /bashbrew.exe https://doi-janky.infosiftr.net/job/bashbrew/job/master/lastSuccessfulBuild/artifact/bashbrew-windows-amd64.exe 51 | - name: build 52 | run: /bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library build caddy 53 | - name: push 54 | # NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/caddyserver/caddy-docker/settings 55 | # the user must have permission to push to https://hub.docker.com/r/caddy/caddy 56 | run: | 57 | echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin; 58 | /bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library push caddy 59 | if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master' 60 | - name: push (non-master dry run) 61 | run: | 62 | /bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library push --dry-run caddy 63 | if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master' 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.task 2 | checksums.txt 3 | -------------------------------------------------------------------------------- /2.10/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.21 2 | 3 | RUN apk add --no-cache \ 4 | ca-certificates \ 5 | libcap \ 6 | mailcap 7 | 8 | RUN set -eux; \ 9 | mkdir -p \ 10 | /config/caddy \ 11 | /data/caddy \ 12 | /etc/caddy \ 13 | /usr/share/caddy \ 14 | ; \ 15 | wget -O /etc/caddy/Caddyfile "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/config/Caddyfile"; \ 16 | wget -O /usr/share/caddy/index.html "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/welcome/index.html" 17 | 18 | # https://github.com/caddyserver/caddy/releases 19 | ENV CADDY_VERSION v2.10.0 20 | 21 | RUN set -eux; \ 22 | apkArch="$(apk --print-arch)"; \ 23 | case "$apkArch" in \ 24 | x86_64) binArch='amd64'; checksum='626682d623ca04356ab3c9a93a82386cfde6d8243b11f2d0eea9e97ba630c7ada62373401e96b72c6690c98ae8dd004d61fafe477f5249690d5cb251ebbfd2d9' ;; \ 25 | armhf) binArch='armv6'; checksum='c4647ed1b5407bd61d55f357af62d3935f2972bb5b03472a2747c4c19610376174bdb573f10b936cbc81acd8a103a0b961118d360cebe2b60693161f83e7f046' ;; \ 26 | armv7) binArch='armv7'; checksum='e6794aef179ec3319c5d692fedbb424532a47d7caf19a67ad2a4317c5f2776baaf47658f9e1f7fd37d6f3447a18285cd1d7cb91d0088f5cd01d73874a43aa9c2' ;; \ 27 | aarch64) binArch='arm64'; checksum='6d100bfd609e8cfe6a51afe1b86066ac68f53ac56670c74a7d7537d93c643aa7f0e82b9f3083218eee1d369a427bfcdafcb445c7a730f9fc0ddf546401d95484' ;; \ 28 | ppc64el|ppc64le) binArch='ppc64le'; checksum='9559d544b8f919837f66623955fd95b03511d85c56455f43d9cc6d0010c00bb1e81fc3b7b5e5a2f8d1d0f65d9571c80cb8b706ea94e2baaaeffec5ae52f68a34' ;; \ 29 | riscv64) binArch='riscv64'; checksum='9633d6f6c2bf1911d5887a5d0ea885413785e0968550875b995eecc3bb5fbd1267edec0add94a0286349273e4df0dc1f1067d5639c2393019e235536c1b7c477' ;; \ 30 | s390x) binArch='s390x'; checksum='5b29b377409abb9b8d241b95a11f1dd5d709759760b1514c9fbf616c3975048cf384441527fdc179bb8b08dc6189afe9df33499b46509e5d0e3bd6da8bb293b1' ;; \ 31 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 32 | esac; \ 33 | wget -O /tmp/caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v2.10.0/caddy_2.10.0_linux_${binArch}.tar.gz"; \ 34 | echo "$checksum /tmp/caddy.tar.gz" | sha512sum -c; \ 35 | tar x -z -f /tmp/caddy.tar.gz -C /usr/bin caddy; \ 36 | rm -f /tmp/caddy.tar.gz; \ 37 | setcap cap_net_bind_service=+ep /usr/bin/caddy; \ 38 | chmod +x /usr/bin/caddy; \ 39 | caddy version 40 | 41 | # See https://caddyserver.com/docs/conventions#file-locations for details 42 | ENV XDG_CONFIG_HOME /config 43 | ENV XDG_DATA_HOME /data 44 | 45 | LABEL org.opencontainers.image.version=v2.10.0 46 | LABEL org.opencontainers.image.title=Caddy 47 | LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go" 48 | LABEL org.opencontainers.image.url=https://caddyserver.com 49 | LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs 50 | LABEL org.opencontainers.image.vendor="Light Code Labs" 51 | LABEL org.opencontainers.image.licenses=Apache-2.0 52 | LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker" 53 | 54 | EXPOSE 80 55 | EXPOSE 443 56 | EXPOSE 443/udp 57 | EXPOSE 2019 58 | 59 | WORKDIR /srv 60 | 61 | CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] 62 | -------------------------------------------------------------------------------- /2.10/alpine/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM alpine:3.21 2 | -------------------------------------------------------------------------------- /2.10/builder/Caddyfile: -------------------------------------------------------------------------------- 1 | :80 2 | 3 | route { 4 | teapot 5 | } 6 | -------------------------------------------------------------------------------- /2.10/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.24-alpine3.21 2 | 3 | RUN apk add --no-cache \ 4 | ca-certificates \ 5 | git \ 6 | libcap 7 | 8 | ENV XCADDY_VERSION v0.4.4 9 | # Configures xcaddy to build with this version of Caddy 10 | ENV CADDY_VERSION v2.10.0 11 | # Configures xcaddy to not clean up post-build (unnecessary in a container) 12 | ENV XCADDY_SKIP_CLEANUP 1 13 | # Sets capabilities for output caddy binary to be able to bind to privileged ports 14 | ENV XCADDY_SETCAP 1 15 | 16 | RUN set -eux; \ 17 | apkArch="$(apk --print-arch)"; \ 18 | case "$apkArch" in \ 19 | x86_64) binArch='amd64'; checksum='09b0bd09c879c2985c562deec675da074f896c9e114717d07f11bdb2714b7e9ecbb26748431732469c245e1517cde6e78ee6b0f6e839de3992d22a3d474188fe' ;; \ 20 | armhf) binArch='armv6'; checksum='dd1ee3d27bb9f0c2b6b900e19e779398c972fc7a0affaf19ee64fb01689cdd18e2df1429251607dbdeca1ad57d1851317c9f0c0c4c4ead3aa2b9e68678a62d52' ;; \ 21 | armv7) binArch='armv7'; checksum='e13003e727c228e84b1abb72db3f92362dd232087256ea51249002d4d0a17d002760123a33dafb8d47553d54c7d821f3d3dee419347a61f967ea4617abaef46a' ;; \ 22 | aarch64) binArch='arm64'; checksum='c04464f944ebad714ded44691d359cf27109f5e088f7ee7ed5b49941c88382b0d31c91b81cb1c11444371abe7c491df06aba7306503a17627a7826ac8992e02a' ;; \ 23 | ppc64el|ppc64le) binArch='ppc64le'; checksum='c05c883e3a6162b77454ed4efa1e28278d0624a53bb096dced95e27b61f60fdcc0a40e90524806fa07e2da654c6420995fede7077c2c2319351f8f0bc1855cd9' ;; \ 24 | riscv64) binArch='riscv64'; checksum='84d1e61330aed77373ffa91dcfda5e20757372fb6ec204e33916a78d864aeb5e0560b2a8aad3166a91311110cb41fce4684a5731cf0d738780f11ee7838811de' ;; \ 25 | s390x) binArch='s390x'; checksum='93ff65601c255e9a2910b8ccfd3bcd4765ea6e5261fab31918e8bef0ffa37bcfaf45e2311fd43f9d9a13751102c3644d107d463fdb64d05c2af02307b96e9772' ;; \ 26 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 27 | esac; \ 28 | wget -O /tmp/xcaddy.tar.gz "https://github.com/caddyserver/xcaddy/releases/download/v0.4.4/xcaddy_0.4.4_linux_${binArch}.tar.gz"; \ 29 | echo "$checksum /tmp/xcaddy.tar.gz" | sha512sum -c; \ 30 | tar x -z -f /tmp/xcaddy.tar.gz -C /usr/bin xcaddy; \ 31 | rm -f /tmp/xcaddy.tar.gz; \ 32 | chmod +x /usr/bin/xcaddy; 33 | 34 | COPY caddy-builder.sh /usr/bin/caddy-builder 35 | 36 | WORKDIR /usr/bin 37 | -------------------------------------------------------------------------------- /2.10/builder/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM golang:1.24-alpine3.21 2 | -------------------------------------------------------------------------------- /2.10/builder/caddy-builder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | 4 | args="" 5 | for p; do 6 | args="$args --with $p" 7 | done 8 | 9 | echo "Warning: the caddy-builder script is deprecated and will be removed in the future. 10 | Instead, you should use the xcaddy command: 11 | 12 | xcaddy build $args 13 | " >&2 14 | 15 | # version is inferred from $CADDY_VERSION (set in the Dockerfile) 16 | # output will be placed in the working dir (/usr/bin as set in the Dockerfile) 17 | xcaddy build $args 18 | -------------------------------------------------------------------------------- /2.10/windows-builder/ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-windowsservercore-ltsc2022 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | ENV XCADDY_VERSION v0.4.4 6 | # Configures xcaddy to build with this version of Caddy 7 | ENV CADDY_VERSION v2.10.0 8 | # Configures xcaddy to not clean up post-build (unnecessary in a container) 9 | ENV XCADDY_SKIP_CLEANUP 1 10 | 11 | RUN Invoke-WebRequest \ 12 | -Uri "https://github.com/caddyserver/xcaddy/releases/download/v0.4.4/xcaddy_0.4.4_windows_amd64.zip" \ 13 | -OutFile "/xcaddy.zip"; \ 14 | if (!(Get-FileHash -Path /xcaddy.zip -Algorithm SHA512).Hash.ToLower().Equals('cbc63529fd591742d67d68ca21c4cdb70a288cb91b20f2d9c711c34b4674d7beccd3aa774e5a6a4b7ea2c8fa92434911288c872b67fe56b8979eedd19130c041')) { exit 1; }; \ 15 | Expand-Archive -Path "/xcaddy.zip" -DestinationPath "/" -Force; \ 16 | Remove-Item "/xcaddy.zip" -Force 17 | 18 | WORKDIR / 19 | -------------------------------------------------------------------------------- /2.10/windows-builder/ltsc2022/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-windowsservercore-ltsc2022 2 | -------------------------------------------------------------------------------- /2.10/windows-builder/ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-windowsservercore-ltsc2025 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | ENV XCADDY_VERSION v0.4.4 6 | # Configures xcaddy to build with this version of Caddy 7 | ENV CADDY_VERSION v2.10.0 8 | # Configures xcaddy to not clean up post-build (unnecessary in a container) 9 | ENV XCADDY_SKIP_CLEANUP 1 10 | 11 | RUN Invoke-WebRequest \ 12 | -Uri "https://github.com/caddyserver/xcaddy/releases/download/v0.4.4/xcaddy_0.4.4_windows_amd64.zip" \ 13 | -OutFile "/xcaddy.zip"; \ 14 | if (!(Get-FileHash -Path /xcaddy.zip -Algorithm SHA512).Hash.ToLower().Equals('cbc63529fd591742d67d68ca21c4cdb70a288cb91b20f2d9c711c34b4674d7beccd3aa774e5a6a4b7ea2c8fa92434911288c872b67fe56b8979eedd19130c041')) { exit 1; }; \ 15 | Expand-Archive -Path "/xcaddy.zip" -DestinationPath "/" -Force; \ 16 | Remove-Item "/xcaddy.zip" -Force 17 | 18 | WORKDIR / 19 | -------------------------------------------------------------------------------- /2.10/windows-builder/ltsc2025/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-windowsservercore-ltsc2025 2 | -------------------------------------------------------------------------------- /2.10/windows/ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | RUN mkdir /config; \ 6 | mkdir /data; \ 7 | mkdir /etc/caddy; \ 8 | mkdir /usr/share/caddy; \ 9 | Invoke-WebRequest \ 10 | -Uri "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/config/Caddyfile" \ 11 | -OutFile "/etc/caddy/Caddyfile"; \ 12 | Invoke-WebRequest \ 13 | -Uri "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/welcome/index.html" \ 14 | -OutFile "/usr/share/caddy/index.html" 15 | 16 | # https://github.com/caddyserver/caddy/releases 17 | ENV CADDY_VERSION v2.10.0 18 | 19 | RUN Invoke-WebRequest \ 20 | -Uri "https://github.com/caddyserver/caddy/releases/download/v2.10.0/caddy_2.10.0_windows_amd64.zip" \ 21 | -OutFile "/caddy.zip"; \ 22 | if (!(Get-FileHash -Path /caddy.zip -Algorithm SHA512).Hash.ToLower().Equals('cb97adb2bff5de752e470486ae72d55a6ddcfe4bfa43f09ed849260955df7f61385ac1e2d28fc80458b6910d71fa38d4295bb0689263dcc1743f2050d847c2ad')) { exit 1; }; \ 23 | Expand-Archive -Path "/caddy.zip" -DestinationPath "/" -Force; \ 24 | Remove-Item "/caddy.zip" -Force 25 | 26 | # See https://caddyserver.com/docs/conventions#file-locations for details 27 | ENV XDG_CONFIG_HOME c:/config 28 | ENV XDG_DATA_HOME c:/data 29 | 30 | LABEL org.opencontainers.image.version=v2.10.0 31 | LABEL org.opencontainers.image.title=Caddy 32 | LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go" 33 | LABEL org.opencontainers.image.url=https://caddyserver.com 34 | LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs 35 | LABEL org.opencontainers.image.vendor="Light Code Labs" 36 | LABEL org.opencontainers.image.licenses=Apache-2.0 37 | LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker" 38 | 39 | EXPOSE 80 40 | EXPOSE 443 41 | EXPOSE 443/udp 42 | EXPOSE 2019 43 | 44 | # Make sure it runs and reports its version 45 | RUN ["caddy", "version"] 46 | 47 | CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] 48 | -------------------------------------------------------------------------------- /2.10/windows/ltsc2022/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 2 | -------------------------------------------------------------------------------- /2.10/windows/ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2025 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | RUN mkdir /config; \ 6 | mkdir /data; \ 7 | mkdir /etc/caddy; \ 8 | mkdir /usr/share/caddy; \ 9 | Invoke-WebRequest \ 10 | -Uri "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/config/Caddyfile" \ 11 | -OutFile "/etc/caddy/Caddyfile"; \ 12 | Invoke-WebRequest \ 13 | -Uri "https://github.com/caddyserver/dist/raw/33ae08ff08d168572df2956ed14fbc4949880d94/welcome/index.html" \ 14 | -OutFile "/usr/share/caddy/index.html" 15 | 16 | # https://github.com/caddyserver/caddy/releases 17 | ENV CADDY_VERSION v2.10.0 18 | 19 | RUN Invoke-WebRequest \ 20 | -Uri "https://github.com/caddyserver/caddy/releases/download/v2.10.0/caddy_2.10.0_windows_amd64.zip" \ 21 | -OutFile "/caddy.zip"; \ 22 | if (!(Get-FileHash -Path /caddy.zip -Algorithm SHA512).Hash.ToLower().Equals('cb97adb2bff5de752e470486ae72d55a6ddcfe4bfa43f09ed849260955df7f61385ac1e2d28fc80458b6910d71fa38d4295bb0689263dcc1743f2050d847c2ad')) { exit 1; }; \ 23 | Expand-Archive -Path "/caddy.zip" -DestinationPath "/" -Force; \ 24 | Remove-Item "/caddy.zip" -Force 25 | 26 | # See https://caddyserver.com/docs/conventions#file-locations for details 27 | ENV XDG_CONFIG_HOME c:/config 28 | ENV XDG_DATA_HOME c:/data 29 | 30 | LABEL org.opencontainers.image.version=v2.10.0 31 | LABEL org.opencontainers.image.title=Caddy 32 | LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go" 33 | LABEL org.opencontainers.image.url=https://caddyserver.com 34 | LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs 35 | LABEL org.opencontainers.image.vendor="Light Code Labs" 36 | LABEL org.opencontainers.image.licenses=Apache-2.0 37 | LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker" 38 | 39 | EXPOSE 80 40 | EXPOSE 443 41 | EXPOSE 443/udp 42 | EXPOSE 2019 43 | 44 | # Make sure it runs and reports its version 45 | RUN ["caddy", "version"] 46 | 47 | CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] 48 | -------------------------------------------------------------------------------- /2.10/windows/ltsc2025/Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2025 2 | -------------------------------------------------------------------------------- /Dockerfile.builder.tmpl: -------------------------------------------------------------------------------- 1 | {{ .base | strings.TrimSpace }} 2 | 3 | RUN apk add --no-cache \ 4 | ca-certificates \ 5 | git \ 6 | libcap 7 | 8 | ENV XCADDY_VERSION v{{ .xcaddy_config.version }} 9 | # Configures xcaddy to build with this version of Caddy 10 | ENV CADDY_VERSION v{{ .config.caddy_version }} 11 | # Configures xcaddy to not clean up post-build (unnecessary in a container) 12 | ENV XCADDY_SKIP_CLEANUP 1 13 | # Sets capabilities for output caddy binary to be able to bind to privileged ports 14 | ENV XCADDY_SETCAP 1 15 | 16 | RUN set -eux; \ 17 | apkArch="$(apk --print-arch)"; \ 18 | case "$apkArch" in \ 19 | x86_64) binArch='amd64'; checksum='{{ .xcaddy_checksums.amd64 }}' ;; \ 20 | armhf) binArch='armv6'; checksum='{{ .xcaddy_checksums.arm32v6 }}' ;; \ 21 | armv7) binArch='armv7'; checksum='{{ .xcaddy_checksums.arm32v7 }}' ;; \ 22 | aarch64) binArch='arm64'; checksum='{{ .xcaddy_checksums.arm64v8 }}' ;; \ 23 | ppc64el|ppc64le) binArch='ppc64le'; checksum='{{ .xcaddy_checksums.ppc64le }}' ;; \ 24 | riscv64) binArch='riscv64'; checksum='{{ .xcaddy_checksums.riscv64 }}' ;; \ 25 | s390x) binArch='s390x'; checksum='{{ .xcaddy_checksums.s390x }}' ;; \ 26 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 27 | esac; \ 28 | wget -O /tmp/xcaddy.tar.gz "https://github.com/caddyserver/xcaddy/releases/download/v{{ .xcaddy_config.version }}/xcaddy_{{ .xcaddy_config.version }}_linux_${binArch}.tar.gz"; \ 29 | echo "$checksum /tmp/xcaddy.tar.gz" | sha512sum -c; \ 30 | tar x -z -f /tmp/xcaddy.tar.gz -C /usr/bin xcaddy; \ 31 | rm -f /tmp/xcaddy.tar.gz; \ 32 | chmod +x /usr/bin/xcaddy; 33 | 34 | COPY caddy-builder.sh /usr/bin/caddy-builder 35 | 36 | WORKDIR /usr/bin 37 | -------------------------------------------------------------------------------- /Dockerfile.tmpl: -------------------------------------------------------------------------------- 1 | {{ .base | strings.TrimSpace }} 2 | 3 | RUN apk add --no-cache \ 4 | ca-certificates \ 5 | libcap \ 6 | mailcap 7 | 8 | RUN set -eux; \ 9 | mkdir -p \ 10 | /config/caddy \ 11 | /data/caddy \ 12 | /etc/caddy \ 13 | /usr/share/caddy \ 14 | ; \ 15 | wget -O /etc/caddy/Caddyfile "https://github.com/caddyserver/dist/raw/{{ .config.dist_commit }}/config/Caddyfile"; \ 16 | wget -O /usr/share/caddy/index.html "https://github.com/caddyserver/dist/raw/{{ .config.dist_commit }}/welcome/index.html" 17 | 18 | # https://github.com/caddyserver/caddy/releases 19 | ENV CADDY_VERSION v{{ .config.caddy_version }} 20 | 21 | RUN set -eux; \ 22 | apkArch="$(apk --print-arch)"; \ 23 | case "$apkArch" in \ 24 | x86_64) binArch='amd64'; checksum='{{ .checksums.amd64 }}' ;; \ 25 | armhf) binArch='armv6'; checksum='{{ .checksums.arm32v6 }}' ;; \ 26 | armv7) binArch='armv7'; checksum='{{ .checksums.arm32v7 }}' ;; \ 27 | aarch64) binArch='arm64'; checksum='{{ .checksums.arm64v8 }}' ;; \ 28 | ppc64el|ppc64le) binArch='ppc64le'; checksum='{{ .checksums.ppc64le }}' ;; \ 29 | riscv64) binArch='riscv64'; checksum='{{ .checksums.riscv64 }}' ;; \ 30 | s390x) binArch='s390x'; checksum='{{ .checksums.s390x }}' ;; \ 31 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 32 | esac; \ 33 | wget -O /tmp/caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v{{ .config.caddy_version }}/caddy_{{ .config.caddy_version }}_linux_${binArch}.tar.gz"; \ 34 | echo "$checksum /tmp/caddy.tar.gz" | sha512sum -c; \ 35 | tar x -z -f /tmp/caddy.tar.gz -C /usr/bin caddy; \ 36 | rm -f /tmp/caddy.tar.gz; \ 37 | setcap cap_net_bind_service=+ep /usr/bin/caddy; \ 38 | chmod +x /usr/bin/caddy; \ 39 | caddy version 40 | 41 | # See https://caddyserver.com/docs/conventions#file-locations for details 42 | ENV XDG_CONFIG_HOME /config 43 | ENV XDG_DATA_HOME /data 44 | 45 | LABEL org.opencontainers.image.version=v{{ .config.caddy_version }} 46 | LABEL org.opencontainers.image.title=Caddy 47 | LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go" 48 | LABEL org.opencontainers.image.url=https://caddyserver.com 49 | LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs 50 | LABEL org.opencontainers.image.vendor="Light Code Labs" 51 | LABEL org.opencontainers.image.licenses=Apache-2.0 52 | LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker" 53 | 54 | EXPOSE 80 55 | EXPOSE 443 56 | EXPOSE 443/udp 57 | EXPOSE 2019 58 | 59 | WORKDIR /srv 60 | 61 | CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] 62 | -------------------------------------------------------------------------------- /Dockerfile.windows-builder.tmpl: -------------------------------------------------------------------------------- 1 | {{ .base | strings.TrimSpace }} 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | ENV XCADDY_VERSION v{{ .xcaddy_config.version }} 6 | # Configures xcaddy to build with this version of Caddy 7 | ENV CADDY_VERSION v{{ .config.caddy_version }} 8 | # Configures xcaddy to not clean up post-build (unnecessary in a container) 9 | ENV XCADDY_SKIP_CLEANUP 1 10 | 11 | RUN Invoke-WebRequest \ 12 | -Uri "https://github.com/caddyserver/xcaddy/releases/download/v{{ .xcaddy_config.version }}/xcaddy_{{ .xcaddy_config.version }}_windows_amd64.zip" \ 13 | -OutFile "/xcaddy.zip"; \ 14 | if (!(Get-FileHash -Path /xcaddy.zip -Algorithm SHA512).Hash.ToLower().Equals('{{ .xcaddy_checksums.windows_amd64 }}')) { exit 1; }; \ 15 | Expand-Archive -Path "/xcaddy.zip" -DestinationPath "/" -Force; \ 16 | Remove-Item "/xcaddy.zip" -Force 17 | 18 | WORKDIR / 19 | -------------------------------------------------------------------------------- /Dockerfile.windows.tmpl: -------------------------------------------------------------------------------- 1 | {{ .base | strings.TrimSpace }} 2 | 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 4 | 5 | RUN mkdir /config; \ 6 | mkdir /data; \ 7 | mkdir /etc/caddy; \ 8 | mkdir /usr/share/caddy; \ 9 | Invoke-WebRequest \ 10 | -Uri "https://github.com/caddyserver/dist/raw/{{ .config.dist_commit }}/config/Caddyfile" \ 11 | -OutFile "/etc/caddy/Caddyfile"; \ 12 | Invoke-WebRequest \ 13 | -Uri "https://github.com/caddyserver/dist/raw/{{ .config.dist_commit }}/welcome/index.html" \ 14 | -OutFile "/usr/share/caddy/index.html" 15 | 16 | # https://github.com/caddyserver/caddy/releases 17 | ENV CADDY_VERSION v{{ .config.caddy_version }} 18 | 19 | RUN Invoke-WebRequest \ 20 | -Uri "https://github.com/caddyserver/caddy/releases/download/v{{ .config.caddy_version }}/caddy_{{ .config.caddy_version }}_windows_amd64.zip" \ 21 | -OutFile "/caddy.zip"; \ 22 | if (!(Get-FileHash -Path /caddy.zip -Algorithm SHA512).Hash.ToLower().Equals('{{ .checksums.windows_amd64 }}')) { exit 1; }; \ 23 | Expand-Archive -Path "/caddy.zip" -DestinationPath "/" -Force; \ 24 | Remove-Item "/caddy.zip" -Force 25 | 26 | # See https://caddyserver.com/docs/conventions#file-locations for details 27 | ENV XDG_CONFIG_HOME c:/config 28 | ENV XDG_DATA_HOME c:/data 29 | 30 | LABEL org.opencontainers.image.version=v{{ .config.caddy_version }} 31 | LABEL org.opencontainers.image.title=Caddy 32 | LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go" 33 | LABEL org.opencontainers.image.url=https://caddyserver.com 34 | LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs 35 | LABEL org.opencontainers.image.vendor="Light Code Labs" 36 | LABEL org.opencontainers.image.licenses=Apache-2.0 37 | LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker" 38 | 39 | EXPOSE 80 40 | EXPOSE 443 41 | EXPOSE 443/udp 42 | EXPOSE 2019 43 | 44 | # Make sure it runs and reports its version 45 | RUN ["caddy", "version"] 46 | 47 | CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # default target is gen-dockerfiles 2 | .DEFAULT_GOAL := gen-dockerfiles 3 | 4 | all: gen-dockerfiles library/caddy .github/dependabot.yml 5 | 6 | gen-dockerfiles: render-dockerfiles.tmpl Dockerfile.tmpl Dockerfile.builder.tmpl Dockerfile.windows.tmpl Dockerfile.windows-builder.tmpl */*/Dockerfile.base 7 | @gomplate \ 8 | --plugin getChecksums=./getChecksums.sh \ 9 | -t dockerfile=Dockerfile.tmpl \ 10 | -t builder-dockerfile=Dockerfile.builder.tmpl \ 11 | -t windows-dockerfile=Dockerfile.windows.tmpl \ 12 | -t windows-builder-dockerfile=Dockerfile.windows-builder.tmpl \ 13 | -t caddy-builder=caddy-builder.sh.tmpl \ 14 | -c config=./stackbrew-config.yaml \ 15 | -f $< 16 | 17 | library/caddy: stackbrew.tmpl stackbrew-config.yaml gen-dockerfiles 18 | @gomplate \ 19 | --plugin fileCommit=./fileCommit.sh \ 20 | -c config=./stackbrew-config.yaml \ 21 | -f $< \ 22 | -o $@ 23 | @touch $@ 24 | 25 | .github/dependabot.yml: .github/dependabot.yml.tmpl $(shell find . -name 'Dockerfile.base') 26 | @gomplate -f $< -o $@ 27 | @touch $@ 28 | 29 | .PHONY: all gen-dockerfiles 30 | .DELETE_ON_ERROR: 31 | .SECONDARY: 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![caddy on DockerHub][dockerhub-image]][dockerhub-url] 2 | [![Docker Build][gh-actions-image]][gh-actions-url] 3 | 4 | # [caddy](https://hub.docker.com/_/caddy) 5 | 6 | This is the repo where the official `caddy` Docker image sources live. 7 | 8 | **Please see https://hub.docker.com/_/caddy for documentation.** 9 | 10 | If you have an issue or suggestion for the Docker image, please [open an issue](https://github.com/caddyserver/caddy-docker/issues/new). 11 | 12 | If you'd like to suggest updates to the [image documentation](https://hub.docker.com/_/caddy), see https://github.com/docker-library/docs/tree/master/caddy. 13 | 14 | ## Release instructions (for maintainers) 15 | 16 | The release process is currently semi-automated, held together with shell scripts and gomplate (and duct tape). 17 | 18 | 1. update the `stackbrew-config.yaml` file (update `caddy_version`) and save 19 | 2. run `make` (note that you'll need [`gomplate`](https://docs.gomplate.ca/installing/) on your path) 20 | 3. commit all changed Dockerfiles and `stackbrew-config.yaml` and issue a PR 21 | 4. once the CI passes and the PR is merged, pull and run `make all` - this should update the `library/caddy` file 22 | 5. commit the updated `library/caddy` file and push directly to `master` 23 | 6. Finally, issue a PR for [`docker-library/official-images/library/caddy`](https://github.com/docker-library/official-images/blob/master/library/caddy) containing the updated `library/caddy` file 24 | 25 | ## License 26 | 27 | View [license information](https://github.com/caddyserver/caddy/blob/master/LICENSE) for the software contained in this image. 28 | 29 | [gh-actions-image]: https://github.com/caddyserver/caddy-docker/workflows/Docker%20Build/badge.svg?branch=master 30 | [gh-actions-url]: https://github.com/caddyserver/caddy-docker/actions?workflow=Docker%20Build&branch=master 31 | 32 | [dockerhub-image]: https://img.shields.io/badge/docker-ready-blue.svg 33 | [dockerhub-url]: https://hub.docker.com/_/caddy 34 | -------------------------------------------------------------------------------- /caddy-builder.sh.tmpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | 4 | args="" 5 | for p; do 6 | args="$args --with $p" 7 | done 8 | 9 | echo "Warning: the caddy-builder script is deprecated and will be removed in the future. 10 | Instead, you should use the xcaddy command: 11 | 12 | xcaddy build $args 13 | " >&2 14 | 15 | # version is inferred from $CADDY_VERSION (set in the Dockerfile) 16 | # output will be placed in the working dir (/usr/bin as set in the Dockerfile) 17 | xcaddy build $args 18 | -------------------------------------------------------------------------------- /fileCommit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | # get the most recent commit which modified any of "$@" 5 | git log -1 --format='format:%H' HEAD -- "$@" 6 | -------------------------------------------------------------------------------- /getChecksums.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # A script that outputs a mapping of arch to checksum for a given release. 4 | # 5 | # Usage: 6 | # ./getChecksums.sh repo version 7 | # 8 | # Example: 9 | # ./getChecksums.sh caddy 2.7.5 10 | # 11 | # repo can be either caddy or xcaddy, and version should be the raw semver, 12 | # without a leading 'v' 13 | # 14 | 15 | REPO=$1 16 | VERSION=$2 17 | # Parse semver 18 | SEMVER_RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z\.-]*\)' 19 | VERSION_MAJOR=`echo ${VERSION} | sed -e "s#$SEMVER_RE#\1#"` 20 | VERSION_MINOR=`echo ${VERSION} | sed -e "s#$SEMVER_RE#\2#"` 21 | VERSION_PATCH=`echo ${VERSION} | sed -e "s#$SEMVER_RE#\3#"` 22 | VERSION_SPECIAL=`echo ${VERSION} | sed -e "s#$SEMVER_RE#\4#"` 23 | 24 | # Get the checksums file from the tagged release 25 | curl -sSL -o checksums.txt https://github.com/caddyserver/${REPO}/releases/download/v${VERSION}/${REPO}_${VERSION}_checksums.txt 26 | 27 | # architecture keys 28 | arches=( 29 | amd64 30 | arm32v6 31 | arm32v7 32 | arm64v8 33 | ppc64le 34 | riscv64 35 | s390x 36 | windows_amd64 37 | ) 38 | 39 | # archives suffixes as they appear in the checksums file 40 | archive_names=( 41 | linux_amd64.tar.gz 42 | linux_armv6.tar.gz 43 | linux_armv7.tar.gz 44 | linux_arm64.tar.gz 45 | linux_ppc64le.tar.gz 46 | linux_riscv64.tar.gz 47 | linux_s390x.tar.gz 48 | windows_amd64.zip 49 | ) 50 | 51 | # Get the last index for the loop 52 | last=$(expr "${#arches[@]}" - 1) 53 | 54 | echo "{" 55 | for i in $(seq 0 $last); do 56 | # Grab the current arch from the list 57 | arch="${arches[i]}" 58 | 59 | # Get the checksum of the archive for this arch 60 | checksum=$(awk "/${archive_names[i]}/{print \$1}" checksums.txt) 61 | 62 | # Skip if we don't have the checksum 63 | [ -z "${checksum}" ] && continue 64 | 65 | if [ $i -lt $last ]; then 66 | echo " \"${arch}\": \"${checksum}\"," 67 | else 68 | echo " \"${arch}\": \"${checksum}\"" 69 | fi 70 | done 71 | echo "}" 72 | -------------------------------------------------------------------------------- /hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -exo pipefail 3 | 4 | # install bashbrew for the build 5 | docker create --name bb hairyhenderson/bashbrew 6 | docker cp bb:/bin/bashbrew . 7 | 8 | export BASHBREW_LIBRARY=./library 9 | export BASHBREW_NAMESPACE=caddy 10 | 11 | ./bashbrew build caddy 12 | ./bashbrew push --dry-run caddy 13 | -------------------------------------------------------------------------------- /library/caddy: -------------------------------------------------------------------------------- 1 | # this file is generated with gomplate: 2 | # template: https://github.com/caddyserver/caddy-docker/blob/e05f66898af9a0a694af637db2724f91d9d82ed7/stackbrew.tmpl 3 | # config context: https://github.com/caddyserver/caddy-docker/blob/b4226f27405e98d9330ca807a80807d5d523ebba/stackbrew-config.yaml 4 | Maintainers: Dave Henderson (@hairyhenderson), 5 | Francis Lavoie (@francislavoie) 6 | 7 | Tags: 2.10.0-alpine, 2.10-alpine, 2-alpine, alpine 8 | SharedTags: 2.10.0, 2.10, 2, latest 9 | GitRepo: https://github.com/caddyserver/caddy-docker.git 10 | Directory: 2.10/alpine 11 | GitCommit: aa3e73e0731fbca665be75edef9fbb60d3169278 12 | Architectures: amd64, arm64v8, arm32v6, arm32v7, ppc64le, riscv64, s390x 13 | 14 | Tags: 2.10.0-builder-alpine, 2.10-builder-alpine, 2-builder-alpine, builder-alpine 15 | SharedTags: 2.10.0-builder, 2.10-builder, 2-builder, builder 16 | GitRepo: https://github.com/caddyserver/caddy-docker.git 17 | Directory: 2.10/builder 18 | GitCommit: aa3e73e0731fbca665be75edef9fbb60d3169278 19 | Architectures: amd64, arm64v8, arm32v6, arm32v7, ppc64le, riscv64, s390x 20 | 21 | Tags: 2.10.0-windowsservercore-ltsc2022, 2.10-windowsservercore-ltsc2022, 2-windowsservercore-ltsc2022, windowsservercore-ltsc2022 22 | SharedTags: 2.10.0-windowsservercore, 2.10-windowsservercore, 2-windowsservercore, windowsservercore, 2.10.0, 2.10, 2, latest 23 | GitRepo: https://github.com/caddyserver/caddy-docker.git 24 | Directory: 2.10/windows/ltsc2022 25 | GitCommit: aa3e73e0731fbca665be75edef9fbb60d3169278 26 | Architectures: windows-amd64 27 | Constraints: windowsservercore-ltsc2022 28 | 29 | Tags: 2.10.0-windowsservercore-ltsc2025, 2.10-windowsservercore-ltsc2025, 2-windowsservercore-ltsc2025, windowsservercore-ltsc2025 30 | SharedTags: 2.10.0-windowsservercore, 2.10-windowsservercore, 2-windowsservercore, windowsservercore, 2.10.0, 2.10, 2, latest 31 | GitRepo: https://github.com/caddyserver/caddy-docker.git 32 | Directory: 2.10/windows/ltsc2025 33 | GitCommit: b4226f27405e98d9330ca807a80807d5d523ebba 34 | Architectures: windows-amd64 35 | Constraints: windowsservercore-ltsc2025 36 | 37 | Tags: 2.10.0-builder-windowsservercore-ltsc2022, 2.10-builder-windowsservercore-ltsc2022, 2-builder-windowsservercore-ltsc2022, builder-windowsservercore-ltsc2022 38 | SharedTags: 2.10.0-builder, 2.10-builder, 2-builder, builder 39 | GitRepo: https://github.com/caddyserver/caddy-docker.git 40 | Directory: 2.10/windows-builder/ltsc2022 41 | GitCommit: aa3e73e0731fbca665be75edef9fbb60d3169278 42 | Architectures: windows-amd64 43 | Constraints: windowsservercore-ltsc2022 44 | 45 | Tags: 2.10.0-builder-windowsservercore-ltsc2025, 2.10-builder-windowsservercore-ltsc2025, 2-builder-windowsservercore-ltsc2025, builder-windowsservercore-ltsc2025 46 | SharedTags: 2.10.0-builder, 2.10-builder, 2-builder, builder 47 | GitRepo: https://github.com/caddyserver/caddy-docker.git 48 | Directory: 2.10/windows-builder/ltsc2025 49 | GitCommit: b4226f27405e98d9330ca807a80807d5d523ebba 50 | Architectures: windows-amd64 51 | Constraints: windowsservercore-ltsc2025 52 | 53 | -------------------------------------------------------------------------------- /render-dockerfiles.tmpl: -------------------------------------------------------------------------------- 1 | {{- range $version := .config.versions }} 2 | {{- $minor := $version.caddy_version | regexp.Replace `([0-9]+\.[0-9]+).*$` `$1` }} 3 | {{- $checksums := getChecksums "caddy" $version.caddy_version | json }} 4 | {{- $xcaddy_checksums := getChecksums "xcaddy" $.config.xcaddy_config.version | json }} 5 | 6 | {{- range $variant := $.config.variants }} 7 | {{- $dir := filepath.Join $minor $variant.dir }} 8 | {{- test.Assert (print "Expected " $dir " to be a directory") (file.IsDir $dir) }} 9 | {{- if not (file.Exists (filepath.Join $dir ".skip")) }} 10 | {{- $template := "dockerfile" }} 11 | {{- if eq "builder" $variant.dir -}} 12 | {{ $template = "builder-dockerfile" -}} 13 | {{ end -}} 14 | {{- if strings.HasPrefix "windows-builder" $variant.dir -}} 15 | {{ $template = "windows-builder-dockerfile" -}} 16 | {{- else if strings.HasPrefix "windows" $variant.dir -}} 17 | {{ $template = "windows-dockerfile" -}} 18 | {{ end -}} 19 | {{- $base := file.Read (filepath.Join $dir "Dockerfile.base") }} 20 | {{- $ctx := dict "base" $base "config" $version "xcaddy_config" $.config.xcaddy_config "checksums" $checksums "xcaddy_checksums" $xcaddy_checksums}} 21 | {{- $outPath := filepath.Join $dir "Dockerfile" -}} 22 | Rendering {{ $outPath }} with template {{ $template }}...{{ "\n" -}} 23 | {{- tmpl.Exec $template $ctx | file.Write $outPath -}} 24 | 25 | {{- if eq "builder" $variant.dir -}} 26 | {{- $template = "caddy-builder" }} 27 | {{- $ctx := dict "config" $version }} 28 | {{- $outPath := filepath.Join $dir "caddy-builder.sh" -}} 29 | Rendering {{ $outPath }} with template {{ $template }}...{{ "\n" -}} 30 | {{- tmpl.Exec $template $ctx | file.Write $outPath -}} 31 | {{ end -}} 32 | {{ end -}} 33 | {{- end }} 34 | {{- end -}} 35 | -------------------------------------------------------------------------------- /stackbrew-config.yaml: -------------------------------------------------------------------------------- 1 | versions: 2 | - caddy_version: '2.10.0' 3 | is_major: true 4 | is_latest: true 5 | dist_commit: 33ae08ff08d168572df2956ed14fbc4949880d94 6 | xcaddy_config: 7 | version: '0.4.4' 8 | # configuration for the stackbrew.tmpl template 9 | variants: 10 | - dir: alpine 11 | tags: [ "alpine" ] 12 | shared_tags: [ "latest" ] 13 | architectures: [ amd64, arm64v8, arm32v6, arm32v7, ppc64le, riscv64, s390x ] 14 | - dir: builder 15 | tags: [ "builder-alpine" ] 16 | shared_tags: [ "builder" ] 17 | architectures: [ amd64, arm64v8, arm32v6, arm32v7, ppc64le, riscv64, s390x ] 18 | - dir: windows/ltsc2022 19 | base_file: Dockerfile.windowsservercore-ltsc2022.base 20 | tags: [ "windowsservercore-ltsc2022" ] 21 | shared_tags: [ "windowsservercore", "latest" ] 22 | architectures: [ windows-amd64 ] 23 | constraints: [ windowsservercore-ltsc2022 ] 24 | - dir: windows/ltsc2025 25 | base_file: Dockerfile.windowsservercore-ltsc2025.base 26 | tags: [ "windowsservercore-ltsc2025" ] 27 | shared_tags: [ "windowsservercore", "latest" ] 28 | architectures: [ windows-amd64 ] 29 | constraints: [ windowsservercore-ltsc2025 ] 30 | - dir: windows-builder/ltsc2022 31 | tags: [ "builder-windowsservercore-ltsc2022" ] 32 | shared_tags: [ "builder" ] 33 | architectures: [ windows-amd64 ] 34 | constraints: [ windowsservercore-ltsc2022 ] 35 | - dir: windows-builder/ltsc2025 36 | tags: [ "builder-windowsservercore-ltsc2025" ] 37 | shared_tags: [ "builder" ] 38 | architectures: [ windows-amd64 ] 39 | constraints: [ windowsservercore-ltsc2025 ] -------------------------------------------------------------------------------- /stackbrew.tmpl: -------------------------------------------------------------------------------- 1 | # this file is generated with gomplate: 2 | # template: https://github.com/caddyserver/caddy-docker/blob/{{ fileCommit "stackbrew.tmpl"}}/stackbrew.tmpl 3 | # config context: https://github.com/caddyserver/caddy-docker/blob/{{ fileCommit "stackbrew-config.yaml"}}/stackbrew-config.yaml 4 | Maintainers: Dave Henderson (@hairyhenderson), 5 | Francis Lavoie (@francislavoie) 6 | {{ range $version := .config.versions }} 7 | {{- $minor := $version.caddy_version | regexp.Replace `([0-9]+\.[0-9]+).*$` `$1` }} 8 | {{- $major := $minor | regexp.Replace `([0-9]+).*$` `$1` }} 9 | 10 | {{- range $variant := $.config.variants }} 11 | {{- $dir := filepath.Join $minor $variant.dir }} 12 | 13 | {{- if and (file.IsDir $dir) (file.Exists (filepath.Join $dir "Dockerfile")) }} 14 | Tags: {{ range $variant.tags }} 15 | {{- print $version.caddy_version "-" . }}, {{ print $minor "-" . }} 16 | {{- if $version.is_major }}, {{ print $major "-" . }}{{ end }} 17 | {{- if $version.is_latest }}, {{ . }}{{ end }} 18 | {{- end }} 19 | 20 | {{- if has $variant "shared_tags" }} 21 | SharedTags: {{ range $i, $tag := $variant.shared_tags }} 22 | {{- if eq "latest" $tag }} 23 | {{- $version.caddy_version }}, {{ $minor }} 24 | {{- if $version.is_major }}, {{ $major }}{{ end }} 25 | {{- else }} 26 | {{- print $version.caddy_version "-" $tag }}, {{ print $minor "-" $tag }} 27 | {{- if $version.is_major }}, {{ print $major "-" $tag }}{{ end }} 28 | {{- end }} 29 | 30 | {{- if $version.is_latest }}, {{ $tag }}{{ end -}} 31 | {{ if lt (add 1 $i) (len $variant.shared_tags) }}, {{end}} 32 | {{- end }} 33 | {{- end }} 34 | GitRepo: https://github.com/caddyserver/caddy-docker.git 35 | Directory: {{ $dir }} 36 | GitCommit: {{ fileCommit $dir }} 37 | Architectures: {{ join $variant.architectures ", " }} 38 | {{- if has $variant "constraints" }} 39 | Constraints: {{ join $variant.constraints ", " }} 40 | {{- end }} 41 | {{ end }}{{ end -}} 42 | {{ end }} 43 | --------------------------------------------------------------------------------