caddy/Dockerfile

60 lines
2.1 KiB
Docker
Raw Normal View History

FROM golang:1.19-alpine as builder
ENV XDG_CONFIG_HOME /config
ENV XDG_DATA_HOME /data
RUN set -e \
export XCADDY_SETCAP=1; \
export version=$(curl -q -LSsf "https://api.github.com/repos/caddyserver/caddy/releases/latest" | jq -r .tag_name | grep '^' || exit 5); \
2022-07-06 21:01:20 -04:00
echo ">>>>>>>>>>>>>>> ${version} ###############"
RUN apk -U upgrade && \
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest || exit 10; \
xcaddy build ${version} \
--output /caddy \
--with github.com/caddy-dns/route53 \
--with github.com/caddy-dns/cloudflare \
--with github.com/caddy-dns/alidns \
--with github.com/caddy-dns/dnspod \
--with github.com/caddy-dns/rfc2136 \
--with github.com/abiosoft/caddy-exec \
--with github.com/greenpau/caddy-trace \
--with github.com/hairyhenderson/caddy-teapot-module \
--with github.com/kirsch33/realip \
--with github.com/porech/caddy-maxmind-geolocation \
2022-07-06 21:01:20 -04:00
--with github.com/caddyserver/transform-encoder \
2022-07-06 21:24:14 -04:00
--with github.com/caddyserver/replace-response
2022-07-09 13:21:03 -04:00
FROM casjaysdevdocker/php:latest as php
COPY --from=builder /caddy /usr/bin/caddy
2022-07-06 21:22:04 -04:00
COPY ./config/Caddyfile /etc/caddy/Caddyfile
COPY ./data/htdocs/. /usr/share/caddy/
COPY ./bin/entrypoint-caddy.sh /usr/local/bin/entrypoint-caddy.sh
FROM php
2022-07-06 21:01:20 -04:00
ARG BUILD_DATE="$(date +'%Y-%m-%d %H:%M')"
LABEL \
org.label-schema.name="caddy" \
org.label-schema.description="Alpine based image with caddy and php8." \
2022-07-09 13:21:03 -04:00
org.label-schema.url="https://hub.docker.com/r/casjaysdevdocker/caddy" \
org.label-schema.vcs-url="https://github.com/casjaysdevdocker/caddy" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.version=$BUILD_DATE \
org.label-schema.vcs-ref=$BUILD_DATE \
2022-07-09 13:21:03 -04:00
org.label-schema.license="WTFPL" \
org.label-schema.vcs-type="Git" \
org.label-schema.schema-version="1.0" \
org.label-schema.vendor="CasjaysDev" \
2022-07-06 21:01:20 -04:00
maintainer="CasjaysDev <docker-admin@casjaysdev.com>"
EXPOSE 1-65535
WORKDIR /data/htdocs
VOLUME [ "/data", "/config" ]
ENTRYPOINT [ "tini", "--" ]
HEALTHCHECK CMD ["/usr/local/bin/entrypoint-caddy.sh", "healthcheck"]
ENTRYPOINT ["/usr/local/bin/entrypoint-caddy.sh"]