2021-04-15 08:46:28 +00:00
|
|
|
ARG version=2.2.3
|
2019-12-14 19:13:41 +00:00
|
|
|
|
2020-06-26 14:41:42 +00:00
|
|
|
FROM golang:1.14-alpine3.11 AS builder
|
|
|
|
ARG version
|
2020-06-18 09:47:31 +00:00
|
|
|
|
2020-06-26 14:41:42 +00:00
|
|
|
WORKDIR /src
|
2019-12-14 19:13:41 +00:00
|
|
|
|
2020-06-26 14:41:42 +00:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
git \
|
|
|
|
ca-certificates
|
|
|
|
|
|
|
|
RUN go get -u github.com/caddyserver/xcaddy/cmd/xcaddy
|
|
|
|
|
|
|
|
ENV CADDY_VERSION="v${version}"
|
|
|
|
RUN xcaddy build --with github.com/caddy-dns/cloudflare --output /usr/bin/caddy
|
2019-12-14 19:13:41 +00:00
|
|
|
|
2020-06-26 14:41:42 +00:00
|
|
|
RUN /usr/bin/caddy version
|
|
|
|
|
|
|
|
FROM caddy:${version}
|
2020-06-18 09:47:31 +00:00
|
|
|
LABEL maintainer "Fabian Stamm <dev@fabianstamm.de>"
|
2019-12-14 19:13:41 +00:00
|
|
|
|
2020-06-26 14:41:42 +00:00
|
|
|
|
|
|
|
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
|
2019-12-14 19:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#Validate install
|
2020-06-18 09:47:31 +00:00
|
|
|
RUN caddy version
|
|
|
|
RUN caddy list-modules
|
2019-12-14 19:13:41 +00:00
|
|
|
|
2020-06-18 09:47:31 +00:00
|
|
|
EXPOSE 80 443 2019
|
|
|
|
|
|
|
|
VOLUME [ "/data", "/config" ]
|
2019-12-14 19:13:41 +00:00
|
|
|
|
|
|
|
WORKDIR /srv
|
|
|
|
|
2020-06-18 09:47:31 +00:00
|
|
|
COPY Caddyfile /etc/Caddyfile
|
|
|
|
|
|
|
|
CMD ["caddy", "run", "--config", "/etc/Caddyfile", "--adapter", "caddyfile"]
|