Caddy distroless docker build
Пример сборки distroless контейнера для caddy⌗
FROM caddy:2.7.5-alpine AS caddy_base
FROM gcr.io/distroless/static-debian12 as debian_nonroot
EXPOSE 80/tcp 443/tcp 8080/tcp
USER nonroot
ENV TZ="Europe/Moscow"
COPY --from=caddy_base --chown=nonroot:nonroot /usr/bin/caddy /usr/bin/caddy
# https://caddyserver.com/docs/conventions#file-locations
COPY --from=caddy_base --chown=nonroot:nonroot /data /data
COPY --from=caddy_base --chown=nonroot:nonroot /config /config
VOLUME /data
VOLUME /config
COPY --from=caddy_base --chown=nonroot:nonroot /etc/caddy/Caddyfile /etc/caddy/Caddyfile
COPY --from=caddy_base --chown=nonroot:nonroot /usr/share/caddy/ /usr/share/caddy/
ENTRYPOINT ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
Читать другие посты