1
0
Fork 0
caddy/update.sh

56 lines
1.7 KiB
Bash
Raw Normal View History

2020-04-08 01:56:21 +08:00
#!/bin/bash
set -Eeuo pipefail
gitHubUpstreamUrl='https://github.com/caddyserver/caddy-docker'
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
_wget() {
wget -qO- -o /dev/null "$@"
}
2020-05-13 11:43:58 +08:00
caddyStackbrew="$(_wget "$gitHubUpstreamUrl/raw/master/stackbrew-config.yaml")"
caddyVersion="$(echo "$caddyStackbrew" | grep -oP '(?<=caddy_version: '"'"').+(?='"'"')')"
2020-04-08 01:56:21 +08:00
cat > scratch/Dockerfile <<-EODF
FROM caddy:$caddyVersion-alpine as build
2020-04-08 01:56:21 +08:00
RUN apk add --no-cache upx ca-certificates \
&& upx --ultra-brute /usr/bin/caddy \
&& caddy version
FROM scratch
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
COPY --from=build /usr/bin/caddy /usr/bin/caddy
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENV XDG_CONFIG_HOME=/config
ENV XDG_DATA_HOME=/data
ENV HOME=/
VOLUME /config
VOLUME /data
2020-05-13 12:35:21 +08:00
LABEL org.opencontainers.image.version=v$caddyVersion
2020-05-13 14:24:40 +08:00
LABEL org.opencontainers.image.title="Caddy (productionwentdown fork)"
2020-04-08 01:56:21 +08:00
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
2020-05-16 13:37:03 +08:00
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
2020-04-08 01:56:21 +08:00
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
LABEL org.opencontainers.image.vendor="productionwentdown"
LABEL org.opencontainers.image.licenses=Apache-2.0
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
EXPOSE 80
EXPOSE 443
EXPOSE 2019
2020-05-13 14:28:40 +08:00
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
2020-04-08 01:56:21 +08:00
EODF